##// END OF EJS Templates
Completely fixed the ipython_win_post_install.py script. It now ...
Brian Granger -
Show More
@@ -1,105 +1,105 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 # 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 # Get some system constants
18 # Get some system constants
39 prefix = sys.prefix
19 prefix = sys.prefix
40 python = pjoin(prefix, 'python.exe')
20 python = pjoin(prefix, 'python.exe')
41
21
42 # Lookup path to common startmenu ...
22 # Lookup path to common startmenu ...
43 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')
44 # Create IPython entry ...
24 # Create IPython entry ...
45 if not os.path.isdir(ip_start_menu):
25 if not os.path.isdir(ip_start_menu):
46 os.mkdir(ip_start_menu)
26 os.mkdir(ip_start_menu)
47 directory_created(ip_start_menu)
27 directory_created(ip_start_menu)
48
28
49 # Create .py and .bat files to make things available from
29 # Create .py and .bat files to make things available from
50 # the Windows command line
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 scripts = pjoin(prefix,'scripts')
41 scripts = pjoin(prefix,'scripts')
53 for program in programs.split():
42 for program in programs:
54 raw = pjoin(scripts, program)
43 raw = pjoin(scripts, program)
55 bat = raw + '.bat'
44 bat = raw + '.bat'
56 py = raw + '.py'
45 py = raw + '.py'
57 # Create .py versions of the scripts
46 # Create .py versions of the scripts
58 shutil.copy(raw, py)
47 shutil.copy(raw, py)
59 # Create .bat files for each of the scripts
48 # Create .bat files for each of the scripts
60 bat_file = file(bat,'w')
49 bat_file = file(bat,'w')
61 bat_file.write("@%s %s %%*" % (python, py))
50 bat_file.write("@%s %s %%*" % (python, py))
62 bat_file.close()
51 bat_file.close()
63
52
64 # Now move onto setting the Start Menu up
53 # Now move onto setting the Start Menu up
65 ipybase = '"' + prefix + r'\scripts\ipython"'
54 ipybase = pjoin(scripts, 'ipython')
66
55
67 # Create program shortcuts ...
56 link = pjoin(ip_start_menu, 'IPython.lnk')
68 f = ip_start_menu + r'\IPython.lnk'
57 cmd = '"%s"' % ipybase
69 a = ipybase
58 mkshortcut(python,'IPython',link,cmd)
70 mkshortcut(python,'IPython',f,a)
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 f = ip_start_menu + r'\pysh.lnk'
72 link = pjoin(ip_start_menu, 'IPython test suite.lnk')
73 a = ipybase+' -p sh'
73 cmd = '"%s" -vv' % pjoin(scripts, 'iptest')
74 mkshortcut(python,'IPython (command prompt mode)',f,a)
74 mkshortcut(python,'Run the IPython test suite',link,cmd)
75
75
76 f = ip_start_menu + r'\pylab.lnk'
76 link = pjoin(ip_start_menu, 'ipcontroller.lnk')
77 a = ipybase+' -pylab'
77 cmd = '"%s" -xy' % pjoin(scripts, 'ipcontroller')
78 mkshortcut(python,'IPython (PyLab mode)',f,a)
78 mkshortcut(python,'IPython controller',link,cmd)
79
79
80 f = ip_start_menu + r'\scipy.lnk'
80 link = pjoin(ip_start_menu, 'ipengine.lnk')
81 a = ipybase+' -pylab -p scipy'
81 cmd = '"%s"' % pjoin(scripts, 'ipengine')
82 mkshortcut(python,'IPython (scipy profile)',f,a)
82 mkshortcut(python,'IPython engine',link,cmd)
83
83
84 # Create documentation shortcuts ...
84 # Create documentation shortcuts ...
85 t = prefix + r'\share\doc\ipython\manual\ipython.pdf'
85 t = prefix + r'\share\doc\ipython\manual\ipython.pdf'
86 f = ip_start_menu + r'\Manual in PDF.lnk'
86 f = ip_start_menu + r'\Manual in PDF.lnk'
87 mkshortcut(t,r'IPython Manual - PDF-Format',f)
87 mkshortcut(t,r'IPython Manual - PDF-Format',f)
88
88
89 t = prefix + r'\share\doc\ipython\manual\html\index.html'
89 t = prefix + r'\share\doc\ipython\manual\html\index.html'
90 f = ip_start_menu + r'\Manual in HTML.lnk'
90 f = ip_start_menu + r'\Manual in HTML.lnk'
91 mkshortcut(t,'IPython Manual - HTML-Format',f)
91 mkshortcut(t,'IPython Manual - HTML-Format',f)
92
92
93
93
94 def remove():
94 def remove():
95 """Routine to be run by the win32 installer with the -remove switch."""
95 """Routine to be run by the win32 installer with the -remove switch."""
96 pass
96 pass
97
97
98 # main()
98 # main()
99 if len(sys.argv) > 1:
99 if len(sys.argv) > 1:
100 if sys.argv[1] == '-install':
100 if sys.argv[1] == '-install':
101 install()
101 install()
102 elif sys.argv[1] == '-remove':
102 elif sys.argv[1] == '-remove':
103 remove()
103 remove()
104 else:
104 else:
105 print "Script was called with option %s" % sys.argv[1]
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