Show More
@@ -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) |
General Comments 0
You need to be logged in to leave comments.
Login now