Show More
@@ -1,105 +1,105 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 | # Some usability warnings at installation time. I don't want them at the | |
|
19 | # top-level, so they don't appear if the user is uninstalling. | |
|
20 | try: | |
|
21 | import ctypes | |
|
22 | except ImportError: | |
|
23 | print ('To take full advantage of IPython, you need ctypes from:\n' | |
|
24 | 'http://sourceforge.net/projects/ctypes') | |
|
25 | ||
|
26 | try: | |
|
27 | import win32con | |
|
28 | except ImportError: | |
|
29 | print ('To take full advantage of IPython, you need pywin32 from:\n' | |
|
30 | 'http://starship.python.net/crew/mhammond/win32/Downloads.html') | |
|
31 | ||
|
32 | try: | |
|
33 | import readline | |
|
34 | except ImportError: | |
|
35 | print ('To take full advantage of IPython, you need readline from:\n' | |
|
36 | 'https://launchpad.net/pyreadline') | |
|
37 | ||
|
38 | 18 | # Get some system constants |
|
39 | 19 | prefix = sys.prefix |
|
40 | 20 | python = pjoin(prefix, 'python.exe') |
|
41 | 21 | |
|
42 | 22 | # Lookup path to common startmenu ... |
|
43 | 23 | ip_start_menu = pjoin(get_special_folder_path('CSIDL_COMMON_PROGRAMS'), 'IPython') |
|
44 | 24 | # Create IPython entry ... |
|
45 | 25 | if not os.path.isdir(ip_start_menu): |
|
46 | 26 | os.mkdir(ip_start_menu) |
|
47 | 27 | directory_created(ip_start_menu) |
|
48 | 28 | |
|
49 | 29 | # Create .py and .bat files to make things available from |
|
50 | 30 | # the Windows command line |
|
51 | programs = 'ipython iptest ipcontroller ipengine ipcluster' | |
|
31 | programs = [ | |
|
32 | 'ipython', | |
|
33 | 'iptest', | |
|
34 | 'ipcontroller', | |
|
35 | 'ipengine', | |
|
36 | 'ipcluster', | |
|
37 | 'ipythonx', | |
|
38 | 'ipython-wx', | |
|
39 | 'irunner' | |
|
40 | ] | |
|
52 | 41 | scripts = pjoin(prefix,'scripts') |
|
53 |
for program in programs |
|
|
42 | for program in programs: | |
|
54 | 43 | raw = pjoin(scripts, program) |
|
55 | 44 | bat = raw + '.bat' |
|
56 | 45 | py = raw + '.py' |
|
57 | 46 | # Create .py versions of the scripts |
|
58 | 47 | shutil.copy(raw, py) |
|
59 | 48 | # Create .bat files for each of the scripts |
|
60 | 49 | bat_file = file(bat,'w') |
|
61 | 50 | bat_file.write("@%s %s %%*" % (python, py)) |
|
62 | 51 | bat_file.close() |
|
63 | ||
|
52 | ||
|
64 | 53 | # Now move onto setting the Start Menu up |
|
65 |
ipybase = ' |
|
|
54 | ipybase = pjoin(scripts, 'ipython') | |
|
66 | 55 | |
|
67 | # Create program shortcuts ... | |
|
68 | f = ip_start_menu + r'\IPython.lnk' | |
|
69 | a = ipybase | |
|
70 | mkshortcut(python,'IPython',f,a) | |
|
56 | link = pjoin(ip_start_menu, 'IPython.lnk') | |
|
57 | cmd = '"%s"' % ipybase | |
|
58 | mkshortcut(python,'IPython',link,cmd) | |
|
59 | ||
|
60 | link = pjoin(ip_start_menu, 'pysh.lnk') | |
|
61 | cmd = '"%s" -p sh' % ipybase | |
|
62 | mkshortcut(python,'IPython (command prompt mode)',link,cmd) | |
|
63 | ||
|
64 | link = pjoin(ip_start_menu, 'pylab.lnk') | |
|
65 | cmd = '"%s" -pylab' % ipybase | |
|
66 | mkshortcut(python,'IPython (PyLab mode)',link,cmd) | |
|
67 | ||
|
68 | link = pjoin(ip_start_menu, 'scipy.lnk') | |
|
69 | cmd = '"%s" -pylab -p scipy' % ipybase | |
|
70 | mkshortcut(python,'IPython (scipy profile)',link,cmd) | |
|
71 | 71 | |
|
72 |
|
|
|
73 | a = ipybase+' -p sh' | |
|
74 |
mkshortcut(python,'IPython |
|
|
72 | link = pjoin(ip_start_menu, 'IPython test suite.lnk') | |
|
73 | cmd = '"%s" -vv' % pjoin(scripts, 'iptest') | |
|
74 | mkshortcut(python,'Run the IPython test suite',link,cmd) | |
|
75 | 75 | |
|
76 |
|
|
|
77 | a = ipybase+' -pylab' | |
|
78 |
mkshortcut(python,'IPython |
|
|
76 | link = pjoin(ip_start_menu, 'ipcontroller.lnk') | |
|
77 | cmd = '"%s" -xy' % pjoin(scripts, 'ipcontroller') | |
|
78 | mkshortcut(python,'IPython controller',link,cmd) | |
|
79 | 79 | |
|
80 |
|
|
|
81 | a = ipybase+' -pylab -p scipy' | |
|
82 |
mkshortcut(python,'IPython |
|
|
80 | link = pjoin(ip_start_menu, 'ipengine.lnk') | |
|
81 | cmd = '"%s"' % pjoin(scripts, 'ipengine') | |
|
82 | mkshortcut(python,'IPython engine',link,cmd) | |
|
83 | 83 | |
|
84 | 84 | # Create documentation shortcuts ... |
|
85 | 85 | t = prefix + r'\share\doc\ipython\manual\ipython.pdf' |
|
86 | 86 | f = ip_start_menu + r'\Manual in PDF.lnk' |
|
87 | 87 | mkshortcut(t,r'IPython Manual - PDF-Format',f) |
|
88 | 88 | |
|
89 | 89 | t = prefix + r'\share\doc\ipython\manual\html\index.html' |
|
90 | 90 | f = ip_start_menu + r'\Manual in HTML.lnk' |
|
91 | 91 | mkshortcut(t,'IPython Manual - HTML-Format',f) |
|
92 | 92 | |
|
93 | 93 | |
|
94 | 94 | def remove(): |
|
95 | 95 | """Routine to be run by the win32 installer with the -remove switch.""" |
|
96 | 96 | pass |
|
97 | 97 | |
|
98 | 98 | # main() |
|
99 | 99 | if len(sys.argv) > 1: |
|
100 | 100 | if sys.argv[1] == '-install': |
|
101 | 101 | install() |
|
102 | 102 | elif sys.argv[1] == '-remove': |
|
103 | 103 | remove() |
|
104 | 104 | else: |
|
105 | 105 | print "Script was called with option %s" % sys.argv[1] |
General Comments 0
You need to be logged in to leave comments.
Login now