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