##// END OF EJS Templates
wininst post install script updated and requires setuptools...
Min RK -
Show More
@@ -4,6 +4,12 b''
4 import os, sys, shutil
4 import os, sys, shutil
5 pjoin = os.path.join
5 pjoin = os.path.join
6
6
7 # import setuptools if we can
8 try:
9 import setuptools
10 except ImportError:
11 pass
12
7 def mkshortcut(target,description,link_file,*args,**kw):
13 def mkshortcut(target,description,link_file,*args,**kw):
8 """make a shortcut if it doesn't exist, and register its creation"""
14 """make a shortcut if it doesn't exist, and register its creation"""
9
15
@@ -18,6 +24,13 b' def install():'
18 # Get some system constants
24 # Get some system constants
19 prefix = sys.prefix
25 prefix = sys.prefix
20 python = pjoin(prefix, 'python.exe')
26 python = pjoin(prefix, 'python.exe')
27 pythonw = pjoin(prefix, 'pythonw.exe')
28 have_setuptools = 'setuptools' in sys.modules
29
30 if not have_setuptools:
31 # This currently doesn't work without setuptools,
32 # so don't bother making broken links
33 return
21
34
22 # Lookup path to common startmenu ...
35 # Lookup path to common startmenu ...
23 ip_start_menu = pjoin(get_special_folder_path('CSIDL_COMMON_PROGRAMS'), 'IPython')
36 ip_start_menu = pjoin(get_special_folder_path('CSIDL_COMMON_PROGRAMS'), 'IPython')
@@ -38,20 +51,22 b' def install():'
38 'irunner'
51 'irunner'
39 ]
52 ]
40 scripts = pjoin(prefix,'scripts')
53 scripts = pjoin(prefix,'scripts')
41 for program in programs:
54 if not have_setuptools:
42 raw = pjoin(scripts, program)
55 # only create .bat files if we don't have setuptools
43 bat = raw + '.bat'
56 for program in programs:
44 py = raw + '.py'
57 raw = pjoin(scripts, program)
45 # Create .py versions of the scripts
58 bat = raw + '.bat'
46 shutil.copy(raw, py)
59 py = raw + '.py'
47 # Create .bat files for each of the scripts
60 # Create .py versions of the scripts
48 bat_file = file(bat,'w')
61 shutil.copy(raw, py)
49 bat_file.write("@%s %s %%*" % (python, py))
62 # Create .bat files for each of the scripts
50 bat_file.close()
63 bat_file = file(bat,'w')
51
64 bat_file.write("@%s %s %%*" % (python, py))
65 bat_file.close()
66
52 # Now move onto setting the Start Menu up
67 # Now move onto setting the Start Menu up
53 ipybase = pjoin(scripts, 'ipython')
68 ipybase = pjoin(scripts, 'ipython')
54 if 'setuptools' in sys.modules:
69 if have_setuptools:
55 # let setuptools take care of the scripts:
70 # let setuptools take care of the scripts:
56 ipybase = ipybase + '-script.py'
71 ipybase = ipybase + '-script.py'
57 workdir = "%HOMEDRIVE%%HOMEPATH%"
72 workdir = "%HOMEDRIVE%%HOMEPATH%"
@@ -61,21 +76,33 b' def install():'
61 mkshortcut(python, 'IPython', link, cmd, workdir)
76 mkshortcut(python, 'IPython', link, cmd, workdir)
62
77
63 link = pjoin(ip_start_menu, 'pysh.lnk')
78 link = pjoin(ip_start_menu, 'pysh.lnk')
64 cmd = '"%s" -p sh' % ipybase
79 cmd = '"%s" profile=pysh --init' % ipybase
65 mkshortcut(python, 'IPython (command prompt mode)', link, cmd, workdir)
80 mkshortcut(python, 'IPython (command prompt mode)', link, cmd, workdir)
66
81
67 link = pjoin(ip_start_menu, 'scipy.lnk')
82 link = pjoin(ip_start_menu, 'pylab.lnk')
68 cmd = '"%s" -p scipy' % ipybase
83 cmd = '"%s" profile=pylab --init' % ipybase
69 mkshortcut(python, 'IPython (scipy profile)', link, cmd, workdir)
84 mkshortcut(python, 'IPython (pylab profile)', link, cmd, workdir)
70
85
71 link = pjoin(ip_start_menu, 'ipcontroller.lnk')
86 link = pjoin(ip_start_menu, 'ipcontroller.lnk')
72 cmd = '"%s" -xy' % pjoin(scripts, 'ipcontroller')
87 cmdbase = pjoin(scripts, 'ipcontroller')
88 if have_setuptools:
89 cmdbase += '-script.py'
90 cmd = '"%s"' % cmdbase
73 mkshortcut(python, 'IPython controller', link, cmd, workdir)
91 mkshortcut(python, 'IPython controller', link, cmd, workdir)
74
92
75 link = pjoin(ip_start_menu, 'ipengine.lnk')
93 link = pjoin(ip_start_menu, 'ipengine.lnk')
76 cmd = '"%s"' % pjoin(scripts, 'ipengine')
94 cmdbase = pjoin(scripts, 'ipengine')
95 if have_setuptools:
96 cmdbase += '-script.py'
97 cmd = '"%s"' % cmdbase
77 mkshortcut(python, 'IPython engine', link, cmd, workdir)
98 mkshortcut(python, 'IPython engine', link, cmd, workdir)
78
99
100 link = pjoin(ip_start_menu, 'ipythonqt.lnk')
101 cmdbase = pjoin(scripts, 'ipython-qtconsole')
102 if have_setuptools:
103 cmdbase += '-script.pyw'
104 cmd = '"%s"' % cmdbase
105 mkshortcut(pythonw, 'IPython Qt Console', link, cmd, workdir)
79 # Create documentation shortcuts ...
106 # Create documentation shortcuts ...
80 t = prefix + r'\share\doc\ipython\manual\ipython.pdf'
107 t = prefix + r'\share\doc\ipython\manual\ipython.pdf'
81 f = ip_start_menu + r'\Manual in PDF.lnk'
108 f = ip_start_menu + r'\Manual in PDF.lnk'
General Comments 0
You need to be logged in to leave comments. Login now