Show More
@@ -1,106 +1,102 b'' | |||||
1 | #!python |
|
1 | #!python | |
2 | """Windows-specific part of the installation""" |
|
2 | """Windows-specific part of the installation""" | |
3 |
|
3 | |||
4 | import os, sys, shutil |
|
4 | import os, sys, shutil | |
5 | pjoin = os.path.join |
|
5 | pjoin = os.path.join | |
6 |
|
6 | |||
7 | def mkshortcut(target,description,link_file,*args,**kw): |
|
7 | def mkshortcut(target,description,link_file,*args,**kw): | |
8 | """make a shortcut if it doesn't exist, and register its creation""" |
|
8 | """make a shortcut if it doesn't exist, and register its creation""" | |
9 |
|
9 | |||
10 | create_shortcut(target, description, link_file,*args,**kw) |
|
10 | create_shortcut(target, description, link_file,*args,**kw) | |
11 | file_created(link_file) |
|
11 | file_created(link_file) | |
12 |
|
12 | |||
13 | def install(): |
|
13 | def install(): | |
14 | """Routine to be run by the win32 installer with the -install switch.""" |
|
14 | """Routine to be run by the win32 installer with the -install switch.""" | |
15 |
|
15 | |||
16 | from IPython.Release import version |
|
16 | from IPython.Release import version | |
17 |
|
17 | |||
18 | # Get some system constants |
|
18 | # Get some system constants | |
19 | prefix = sys.prefix |
|
19 | prefix = sys.prefix | |
20 | python = pjoin(prefix, 'python.exe') |
|
20 | python = pjoin(prefix, 'python.exe') | |
21 |
|
21 | |||
22 | # Lookup path to common startmenu ... |
|
22 | # Lookup path to common startmenu ... | |
23 | ip_start_menu = pjoin(get_special_folder_path('CSIDL_COMMON_PROGRAMS'), 'IPython') |
|
23 | ip_start_menu = pjoin(get_special_folder_path('CSIDL_COMMON_PROGRAMS'), 'IPython') | |
24 | # Create IPython entry ... |
|
24 | # Create IPython entry ... | |
25 | if not os.path.isdir(ip_start_menu): |
|
25 | if not os.path.isdir(ip_start_menu): | |
26 | os.mkdir(ip_start_menu) |
|
26 | os.mkdir(ip_start_menu) | |
27 | directory_created(ip_start_menu) |
|
27 | directory_created(ip_start_menu) | |
28 |
|
28 | |||
29 | # Create .py and .bat files to make things available from |
|
29 | # Create .py and .bat files to make things available from | |
30 | # the Windows command line. Thanks to the Twisted project |
|
30 | # the Windows command line. Thanks to the Twisted project | |
31 | # for this logic! |
|
31 | # for this logic! | |
32 | programs = [ |
|
32 | programs = [ | |
33 | 'ipython', |
|
33 | 'ipython', | |
34 | 'iptest', |
|
34 | 'iptest', | |
35 | 'ipcontroller', |
|
35 | 'ipcontroller', | |
36 | 'ipengine', |
|
36 | 'ipengine', | |
37 | 'ipcluster', |
|
37 | 'ipcluster', | |
38 | 'ipythonx', |
|
38 | 'ipythonx', | |
39 | 'ipython-wx', |
|
39 | 'ipython-wx', | |
40 | 'irunner' |
|
40 | 'irunner' | |
41 | ] |
|
41 | ] | |
42 | scripts = pjoin(prefix,'scripts') |
|
42 | scripts = pjoin(prefix,'scripts') | |
43 | for program in programs: |
|
43 | for program in programs: | |
44 | raw = pjoin(scripts, program) |
|
44 | raw = pjoin(scripts, program) | |
45 | bat = raw + '.bat' |
|
45 | bat = raw + '.bat' | |
46 | py = raw + '.py' |
|
46 | py = raw + '.py' | |
47 | # Create .py versions of the scripts |
|
47 | # Create .py versions of the scripts | |
48 | shutil.copy(raw, py) |
|
48 | shutil.copy(raw, py) | |
49 | # Create .bat files for each of the scripts |
|
49 | # Create .bat files for each of the scripts | |
50 | bat_file = file(bat,'w') |
|
50 | bat_file = file(bat,'w') | |
51 | bat_file.write("@%s %s %%*" % (python, py)) |
|
51 | bat_file.write("@%s %s %%*" % (python, py)) | |
52 | bat_file.close() |
|
52 | bat_file.close() | |
53 |
|
53 | |||
54 | # Now move onto setting the Start Menu up |
|
54 | # Now move onto setting the Start Menu up | |
55 | ipybase = pjoin(scripts, 'ipython') |
|
55 | ipybase = pjoin(scripts, 'ipython') | |
56 |
|
56 | |||
57 | link = pjoin(ip_start_menu, 'IPython.lnk') |
|
57 | link = pjoin(ip_start_menu, 'IPython.lnk') | |
58 | cmd = '"%s"' % ipybase |
|
58 | cmd = '"%s"' % ipybase | |
59 | mkshortcut(python,'IPython',link,cmd) |
|
59 | mkshortcut(python,'IPython',link,cmd) | |
60 |
|
60 | |||
61 | link = pjoin(ip_start_menu, 'pysh.lnk') |
|
61 | link = pjoin(ip_start_menu, 'pysh.lnk') | |
62 | cmd = '"%s" -p sh' % ipybase |
|
62 | cmd = '"%s" -p sh' % ipybase | |
63 | mkshortcut(python,'IPython (command prompt mode)',link,cmd) |
|
63 | mkshortcut(python,'IPython (command prompt mode)',link,cmd) | |
64 |
|
64 | |||
65 | link = pjoin(ip_start_menu, 'pylab.lnk') |
|
65 | link = pjoin(ip_start_menu, 'pylab.lnk') | |
66 | cmd = '"%s" -pylab' % ipybase |
|
66 | cmd = '"%s" -pylab' % ipybase | |
67 | mkshortcut(python,'IPython (PyLab mode)',link,cmd) |
|
67 | mkshortcut(python,'IPython (PyLab mode)',link,cmd) | |
68 |
|
68 | |||
69 | link = pjoin(ip_start_menu, 'scipy.lnk') |
|
69 | link = pjoin(ip_start_menu, 'scipy.lnk') | |
70 | cmd = '"%s" -pylab -p scipy' % ipybase |
|
70 | cmd = '"%s" -pylab -p scipy' % ipybase | |
71 | mkshortcut(python,'IPython (scipy profile)',link,cmd) |
|
71 | mkshortcut(python,'IPython (scipy profile)',link,cmd) | |
72 |
|
72 | |||
73 | link = pjoin(ip_start_menu, 'IPython test suite.lnk') |
|
|||
74 | cmd = '"%s" -vv' % pjoin(scripts, 'iptest') |
|
|||
75 | mkshortcut(python,'Run the IPython test suite',link,cmd) |
|
|||
76 |
|
||||
77 | link = pjoin(ip_start_menu, 'ipcontroller.lnk') |
|
73 | link = pjoin(ip_start_menu, 'ipcontroller.lnk') | |
78 | cmd = '"%s" -xy' % pjoin(scripts, 'ipcontroller') |
|
74 | cmd = '"%s" -xy' % pjoin(scripts, 'ipcontroller') | |
79 | mkshortcut(python,'IPython controller',link,cmd) |
|
75 | mkshortcut(python,'IPython controller',link,cmd) | |
80 |
|
76 | |||
81 | link = pjoin(ip_start_menu, 'ipengine.lnk') |
|
77 | link = pjoin(ip_start_menu, 'ipengine.lnk') | |
82 | cmd = '"%s"' % pjoin(scripts, 'ipengine') |
|
78 | cmd = '"%s"' % pjoin(scripts, 'ipengine') | |
83 | mkshortcut(python,'IPython engine',link,cmd) |
|
79 | mkshortcut(python,'IPython engine',link,cmd) | |
84 |
|
80 | |||
85 | # Create documentation shortcuts ... |
|
81 | # Create documentation shortcuts ... | |
86 | t = prefix + r'\share\doc\ipython\manual\ipython.pdf' |
|
82 | t = prefix + r'\share\doc\ipython\manual\ipython.pdf' | |
87 | f = ip_start_menu + r'\Manual in PDF.lnk' |
|
83 | f = ip_start_menu + r'\Manual in PDF.lnk' | |
88 | mkshortcut(t,r'IPython Manual - PDF-Format',f) |
|
84 | mkshortcut(t,r'IPython Manual - PDF-Format',f) | |
89 |
|
85 | |||
90 | t = prefix + r'\share\doc\ipython\manual\html\index.html' |
|
86 | t = prefix + r'\share\doc\ipython\manual\html\index.html' | |
91 | f = ip_start_menu + r'\Manual in HTML.lnk' |
|
87 | f = ip_start_menu + r'\Manual in HTML.lnk' | |
92 | mkshortcut(t,'IPython Manual - HTML-Format',f) |
|
88 | mkshortcut(t,'IPython Manual - HTML-Format',f) | |
93 |
|
89 | |||
94 |
|
90 | |||
95 | def remove(): |
|
91 | def remove(): | |
96 | """Routine to be run by the win32 installer with the -remove switch.""" |
|
92 | """Routine to be run by the win32 installer with the -remove switch.""" | |
97 | pass |
|
93 | pass | |
98 |
|
94 | |||
99 | # main() |
|
95 | # main() | |
100 | if len(sys.argv) > 1: |
|
96 | if len(sys.argv) > 1: | |
101 | if sys.argv[1] == '-install': |
|
97 | if sys.argv[1] == '-install': | |
102 | install() |
|
98 | install() | |
103 | elif sys.argv[1] == '-remove': |
|
99 | elif sys.argv[1] == '-remove': | |
104 | remove() |
|
100 | remove() | |
105 | else: |
|
101 | else: | |
106 | print "Script was called with option %s" % sys.argv[1] |
|
102 | print "Script was called with option %s" % sys.argv[1] |
General Comments 0
You need to be logged in to leave comments.
Login now