Show More
@@ -5,7 +5,10 b'' | |||||
5 | from __future__ import print_function |
|
5 | from __future__ import print_function | |
6 |
|
6 | |||
7 | import itertools |
|
7 | import itertools | |
8 | import readline |
|
8 | try: | |
|
9 | import readline | |||
|
10 | except ImportError: | |||
|
11 | readline = None | |||
9 | import rlcompleter |
|
12 | import rlcompleter | |
10 | import time |
|
13 | import time | |
11 |
|
14 | |||
@@ -37,8 +40,9 b' class ClientCompleter(object):' | |||||
37 | and then return them for each value of state.""" |
|
40 | and then return them for each value of state.""" | |
38 |
|
41 | |||
39 | def __init__(self, client, session, socket): |
|
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 | self.client = client |
|
46 | self.client = client | |
43 | self.session = session |
|
47 | self.session = session | |
44 | self.socket = socket |
|
48 | self.socket = socket |
@@ -1,6 +1,8 b'' | |||||
1 | #!python |
|
1 | #!python | |
2 | """Windows-specific part of the installation""" |
|
2 | """Windows-specific part of the installation""" | |
3 |
|
3 | |||
|
4 | from __future__ import print_function | |||
|
5 | ||||
4 | import os, sys, shutil |
|
6 | import os, sys, shutil | |
5 | pjoin = os.path.join |
|
7 | pjoin = os.path.join | |
6 |
|
8 | |||
@@ -17,12 +19,15 b' def mkshortcut(target,description,link_file,*args,**kw):' | |||||
17 | create_shortcut(target, description, link_file,*args,**kw) |
|
19 | create_shortcut(target, description, link_file,*args,**kw) | |
18 | file_created(link_file) |
|
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 | def install(): |
|
28 | def install(): | |
22 | """Routine to be run by the win32 installer with the -install switch.""" |
|
29 | """Routine to be run by the win32 installer with the -install switch.""" | |
23 |
|
30 | |||
24 | from IPython.core.release import version |
|
|||
25 |
|
||||
26 | # Get some system constants |
|
31 | # Get some system constants | |
27 | prefix = sys.prefix |
|
32 | prefix = sys.prefix | |
28 | python = pjoin(prefix, 'python.exe') |
|
33 | python = pjoin(prefix, 'python.exe') | |
@@ -55,6 +60,7 b' def install():' | |||||
55 | 'ipcluster', |
|
60 | 'ipcluster', | |
56 | 'irunner' |
|
61 | 'irunner' | |
57 | ] |
|
62 | ] | |
|
63 | programs = [ suffix(p) for p in programs ] | |||
58 | scripts = pjoin(prefix,'scripts') |
|
64 | scripts = pjoin(prefix,'scripts') | |
59 | if not have_setuptools: |
|
65 | if not have_setuptools: | |
60 | # only create .bat files if we don't have setuptools |
|
66 | # only create .bat files if we don't have setuptools | |
@@ -70,7 +76,7 b' def install():' | |||||
70 | bat_file.close() |
|
76 | bat_file.close() | |
71 |
|
77 | |||
72 | # Now move onto setting the Start Menu up |
|
78 | # Now move onto setting the Start Menu up | |
73 | ipybase = pjoin(scripts, 'ipython') |
|
79 | ipybase = suffix(pjoin(scripts, 'ipython')) | |
74 | if have_setuptools: |
|
80 | if have_setuptools: | |
75 | # let setuptools take care of the scripts: |
|
81 | # let setuptools take care of the scripts: | |
76 | ipybase = ipybase + '-script.py' |
|
82 | ipybase = ipybase + '-script.py' | |
@@ -93,21 +99,21 b' def install():' | |||||
93 | mkshortcut(python, 'IPython (pylab profile)', link, cmd, workdir) |
|
99 | mkshortcut(python, 'IPython (pylab profile)', link, cmd, workdir) | |
94 |
|
100 | |||
95 | link = pjoin(ip_start_menu, 'ipcontroller.lnk') |
|
101 | link = pjoin(ip_start_menu, 'ipcontroller.lnk') | |
96 | cmdbase = pjoin(scripts, 'ipcontroller') |
|
102 | cmdbase = suffix(pjoin(scripts, 'ipcontroller')) | |
97 | if have_setuptools: |
|
103 | if have_setuptools: | |
98 | cmdbase += '-script.py' |
|
104 | cmdbase += '-script.py' | |
99 | cmd = '"%s"' % cmdbase |
|
105 | cmd = '"%s"' % cmdbase | |
100 | mkshortcut(python, 'IPython controller', link, cmd, workdir) |
|
106 | mkshortcut(python, 'IPython controller', link, cmd, workdir) | |
101 |
|
107 | |||
102 | link = pjoin(ip_start_menu, 'ipengine.lnk') |
|
108 | link = pjoin(ip_start_menu, 'ipengine.lnk') | |
103 | cmdbase = pjoin(scripts, 'ipengine') |
|
109 | cmdbase = suffix(pjoin(scripts, 'ipengine')) | |
104 | if have_setuptools: |
|
110 | if have_setuptools: | |
105 | cmdbase += '-script.py' |
|
111 | cmdbase += '-script.py' | |
106 | cmd = '"%s"' % cmdbase |
|
112 | cmd = '"%s"' % cmdbase | |
107 | mkshortcut(python, 'IPython engine', link, cmd, workdir) |
|
113 | mkshortcut(python, 'IPython engine', link, cmd, workdir) | |
108 |
|
114 | |||
109 | link = pjoin(ip_start_menu, 'ipythonqt.lnk') |
|
115 | link = pjoin(ip_start_menu, 'ipythonqt.lnk') | |
110 |
cmdbase = pjoin(scripts, 'ipython |
|
116 | cmdbase = suffix(pjoin(scripts, 'ipython')) + '-qtconsole' | |
111 | if have_setuptools: |
|
117 | if have_setuptools: | |
112 | cmdbase += '-script.pyw' |
|
118 | cmdbase += '-script.pyw' | |
113 | cmd = '"%s"' % cmdbase |
|
119 | cmd = '"%s"' % cmdbase | |
@@ -126,8 +132,11 b' def remove():' | |||||
126 | # main() |
|
132 | # main() | |
127 | if len(sys.argv) > 1: |
|
133 | if len(sys.argv) > 1: | |
128 | if sys.argv[1] == '-install': |
|
134 | if sys.argv[1] == '-install': | |
129 |
|
|
135 | try: | |
|
136 | install() | |||
|
137 | except OSError: | |||
|
138 | print("Failed to create Start Menu items, try running installer as administrator.", file=sys.stderr) | |||
130 | elif sys.argv[1] == '-remove': |
|
139 | elif sys.argv[1] == '-remove': | |
131 | remove() |
|
140 | remove() | |
132 | else: |
|
141 | else: | |
133 |
print |
|
142 | print("Script was called with option %s" % sys.argv[1], file=sys.stderr) |
@@ -1,4 +1,5 b'' | |||||
1 | import os.path |
|
1 | import os.path | |
|
2 | import sys | |||
2 | from setuptools import setup |
|
3 | from setuptools import setup | |
3 | from setuptools.command.build_py import build_py |
|
4 | from setuptools.command.build_py import build_py | |
4 |
|
5 | |||
@@ -14,6 +15,20 b" setup_args['packages'] = find_packages()" | |||||
14 | setup_args['package_data'] = find_package_data() |
|
15 | setup_args['package_data'] = find_package_data() | |
15 | setup_args['cmdclass'] = {'build_py': record_commit_info('IPython', build_cmd=build_py)} |
|
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 | def main(): |
|
32 | def main(): | |
18 | setup(use_2to3 = True, **setup_args) |
|
33 | setup(use_2to3 = True, **setup_args) | |
19 |
|
34 |
General Comments 0
You need to be logged in to leave comments.
Login now