##// END OF EJS Templates
Merge PR #1143 (Python3 StartMenu items)...
MinRK -
r5682:5047149d merge
parent child Browse files
Show More
@@ -5,7 +5,10 b''
5 5 from __future__ import print_function
6 6
7 7 import itertools
8 try:
8 9 import readline
10 except ImportError:
11 readline = None
9 12 import rlcompleter
10 13 import time
11 14
@@ -39,6 +42,7 b' class ClientCompleter(object):'
39 42 def __init__(self, client, session, socket):
40 43 # ugly, but we get called asynchronously and need access to some
41 44 # client state, like backgrounded code
45 assert readline is not None, "ClientCompleter depends on readline"
42 46 self.client = client
43 47 self.session = session
44 48 self.socket = socket
@@ -1,6 +1,8 b''
1 1 #!python
2 2 """Windows-specific part of the installation"""
3 3
4 from __future__ import print_function
5
4 6 import os, sys, shutil
5 7 pjoin = os.path.join
6 8
@@ -17,12 +19,15 b' def mkshortcut(target,description,link_file,*args,**kw):'
17 19 create_shortcut(target, description, link_file,*args,**kw)
18 20 file_created(link_file)
19 21
22 def suffix(s):
23 """add '3' suffix to programs for Python 3"""
24 if sys.version_info[0] == 3:
25 s = s+'3'
26 return s
20 27
21 28 def install():
22 29 """Routine to be run by the win32 installer with the -install switch."""
23 30
24 from IPython.core.release import version
25
26 31 # Get some system constants
27 32 prefix = sys.prefix
28 33 python = pjoin(prefix, 'python.exe')
@@ -55,6 +60,7 b' def install():'
55 60 'ipcluster',
56 61 'irunner'
57 62 ]
63 programs = [ suffix(p) for p in programs ]
58 64 scripts = pjoin(prefix,'scripts')
59 65 if not have_setuptools:
60 66 # only create .bat files if we don't have setuptools
@@ -70,7 +76,7 b' def install():'
70 76 bat_file.close()
71 77
72 78 # Now move onto setting the Start Menu up
73 ipybase = pjoin(scripts, 'ipython')
79 ipybase = suffix(pjoin(scripts, 'ipython'))
74 80 if have_setuptools:
75 81 # let setuptools take care of the scripts:
76 82 ipybase = ipybase + '-script.py'
@@ -93,21 +99,21 b' def install():'
93 99 mkshortcut(python, 'IPython (pylab profile)', link, cmd, workdir)
94 100
95 101 link = pjoin(ip_start_menu, 'ipcontroller.lnk')
96 cmdbase = pjoin(scripts, 'ipcontroller')
102 cmdbase = suffix(pjoin(scripts, 'ipcontroller'))
97 103 if have_setuptools:
98 104 cmdbase += '-script.py'
99 105 cmd = '"%s"' % cmdbase
100 106 mkshortcut(python, 'IPython controller', link, cmd, workdir)
101 107
102 108 link = pjoin(ip_start_menu, 'ipengine.lnk')
103 cmdbase = pjoin(scripts, 'ipengine')
109 cmdbase = suffix(pjoin(scripts, 'ipengine'))
104 110 if have_setuptools:
105 111 cmdbase += '-script.py'
106 112 cmd = '"%s"' % cmdbase
107 113 mkshortcut(python, 'IPython engine', link, cmd, workdir)
108 114
109 115 link = pjoin(ip_start_menu, 'ipythonqt.lnk')
110 cmdbase = pjoin(scripts, 'ipython-qtconsole')
116 cmdbase = suffix(pjoin(scripts, 'ipython')) + '-qtconsole'
111 117 if have_setuptools:
112 118 cmdbase += '-script.pyw'
113 119 cmd = '"%s"' % cmdbase
@@ -126,8 +132,11 b' def remove():'
126 132 # main()
127 133 if len(sys.argv) > 1:
128 134 if sys.argv[1] == '-install':
135 try:
129 136 install()
137 except OSError:
138 print("Failed to create Start Menu items, try running installer as administrator.", file=sys.stderr)
130 139 elif sys.argv[1] == '-remove':
131 140 remove()
132 141 else:
133 print "Script was called with option %s" % sys.argv[1]
142 print("Script was called with option %s" % sys.argv[1], file=sys.stderr)
@@ -1,4 +1,5 b''
1 1 import os.path
2 import sys
2 3 from setuptools import setup
3 4 from setuptools.command.build_py import build_py
4 5
@@ -14,6 +15,20 b" setup_args['packages'] = find_packages()"
14 15 setup_args['package_data'] = find_package_data()
15 16 setup_args['cmdclass'] = {'build_py': record_commit_info('IPython', build_cmd=build_py)}
16 17
18 # Script to be run by the windows binary installer after the default setup
19 # routine, to add shortcuts and similar windows-only things. Windows
20 # post-install scripts MUST reside in the scripts/ dir, otherwise distutils
21 # doesn't find them.
22 if 'bdist_wininst' in sys.argv:
23 if len(sys.argv) > 2 and \
24 ('sdist' in sys.argv or 'bdist_rpm' in sys.argv):
25 print >> sys.stderr, "ERROR: bdist_wininst must be run alone. Exiting."
26 sys.exit(1)
27 setup_args['scripts'] = [os.path.join('scripts','ipython_win_post_install.py')]
28 setup_args['options'] = {"bdist_wininst":
29 {"install_script":
30 "ipython_win_post_install.py"}}
31
17 32 def main():
18 33 setup(use_2to3 = True, **setup_args)
19 34
General Comments 0
You need to be logged in to leave comments. Login now