##// END OF EJS Templates
Tried to fix the windows post install script. It now creates...
Brian Granger -
Show More
@@ -2,6 +2,7 b''
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
6
6 def mkshortcut(target,description,link_file,*args,**kw):
7 def mkshortcut(target,description,link_file,*args,**kw):
7 """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"""
@@ -11,14 +12,8 b' def mkshortcut(target,description,link_file,*args,**kw):'
11
12
12 def install():
13 def install():
13 """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."""
14
15
15 from IPython.Release import version
16 from IPython.Release import version
16
17 # Get some system constants
18 prefix = sys.prefix
19 python = prefix + r'\python.exe'
20 # Lookup path to common startmenu ...
21 ip_dir = get_special_folder_path('CSIDL_COMMON_PROGRAMS') + r'\IPython'
22
17
23 # Some usability warnings at installation time. I don't want them at the
18 # Some usability warnings at installation time. I don't want them at the
24 # top-level, so they don't appear if the user is uninstalling.
19 # top-level, so they don't appear if the user is uninstalling.
@@ -27,53 +22,74 b' def install():'
27 except ImportError:
22 except ImportError:
28 print ('To take full advantage of IPython, you need ctypes from:\n'
23 print ('To take full advantage of IPython, you need ctypes from:\n'
29 'http://sourceforge.net/projects/ctypes')
24 'http://sourceforge.net/projects/ctypes')
30
25
31 try:
26 try:
32 import win32con
27 import win32con
33 except ImportError:
28 except ImportError:
34 print ('To take full advantage of IPython, you need pywin32 from:\n'
29 print ('To take full advantage of IPython, you need pywin32 from:\n'
35 'http://starship.python.net/crew/mhammond/win32/Downloads.html')
30 'http://starship.python.net/crew/mhammond/win32/Downloads.html')
36
31
37 try:
32 try:
38 import readline
33 import readline
39 except ImportError:
34 except ImportError:
40 print ('To take full advantage of IPython, you need readline from:\n'
35 print ('To take full advantage of IPython, you need readline from:\n'
41 'https://launchpad.net/pyreadline')
36 'https://launchpad.net/pyreadline')
42
37
43 ipybase = '"' + prefix + r'\scripts\ipython"'
38 # Get some system constants
39 prefix = sys.prefix
40 python = pjoin(prefix, 'python.exe')
41
42 # Lookup path to common startmenu ...
43 ip_start_menu = pjoin(get_special_folder_path('CSIDL_COMMON_PROGRAMS'), 'IPython')
44 # Create IPython entry ...
44 # Create IPython entry ...
45 if not os.path.isdir(ip_dir):
45 if not os.path.isdir(ip_start_menu):
46 os.mkdir(ip_dir)
46 os.mkdir(ip_start_menu)
47 directory_created(ip_dir)
47 directory_created(ip_start_menu)
48
49 # Create .py and .bat files to make things available from
50 # the Windows command line
51 programs = 'ipython iptest ipcontroller ipengine ipcluster'
52 scripts = pjoin(prefix,'scripts')
53 for program in programs.split():
54 raw = pjoin(scripts, program)
55 bat = raw + '.bat'
56 py = raw + '.py'
57 # Create .py versions of the scripts
58 shutil.copy(raw, py)
59 # Create .bat files for each of the scripts
60 bat_file = file(bat,'w')
61 bat_file.write("@%s %s %%*" % (python, py))
62 bat_file.close()
63
64 # Now move onto setting the Start Menu up
65 ipybase = '"' + prefix + r'\scripts\ipython"'
48
66
49 # Create program shortcuts ...
67 # Create program shortcuts ...
50 f = ip_dir + r'\IPython.lnk'
68 f = ip_start_menu + r'\IPython.lnk'
51 a = ipybase
69 a = ipybase
52 mkshortcut(python,'IPython',f,a)
70 mkshortcut(python,'IPython',f,a)
53
71
54 f = ip_dir + r'\pysh.lnk'
72 f = ip_start_menu + r'\pysh.lnk'
55 a = ipybase+' -p sh'
73 a = ipybase+' -p sh'
56 mkshortcut(python,'IPython (command prompt mode)',f,a)
74 mkshortcut(python,'IPython (command prompt mode)',f,a)
57
75
58 f = ip_dir + r'\pylab.lnk'
76 f = ip_start_menu + r'\pylab.lnk'
59 a = ipybase+' -pylab'
77 a = ipybase+' -pylab'
60 mkshortcut(python,'IPython (PyLab mode)',f,a)
78 mkshortcut(python,'IPython (PyLab mode)',f,a)
61
79
62 f = ip_dir + r'\scipy.lnk'
80 f = ip_start_menu + r'\scipy.lnk'
63 a = ipybase+' -pylab -p scipy'
81 a = ipybase+' -pylab -p scipy'
64 mkshortcut(python,'IPython (scipy profile)',f,a)
82 mkshortcut(python,'IPython (scipy profile)',f,a)
65
83
66 # Create documentation shortcuts ...
84 # Create documentation shortcuts ...
67 t = prefix + r'\share\doc\ipython\manual\ipython.pdf'
85 t = prefix + r'\share\doc\ipython\manual\ipython.pdf'
68 f = ip_dir + r'\Manual in PDF.lnk'
86 f = ip_start_menu + r'\Manual in PDF.lnk'
69 mkshortcut(t,r'IPython Manual - PDF-Format',f)
87 mkshortcut(t,r'IPython Manual - PDF-Format',f)
70
88
71 t = prefix + r'\share\doc\ipython\manual\html\index.html'
89 t = prefix + r'\share\doc\ipython\manual\html\index.html'
72 f = ip_dir + r'\Manual in HTML.lnk'
90 f = ip_start_menu + r'\Manual in HTML.lnk'
73 mkshortcut(t,'IPython Manual - HTML-Format',f)
91 mkshortcut(t,'IPython Manual - HTML-Format',f)
74
92
75 # make ipython.py
76 shutil.copy(prefix + r'\scripts\ipython', prefix + r'\scripts\ipython.py')
77
93
78 def remove():
94 def remove():
79 """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."""
General Comments 0
You need to be logged in to leave comments. Login now