Show More
@@ -1,32 +1,33 b'' | |||
|
1 | 1 | include README_Windows.txt |
|
2 | 2 | include win32_manual_post_install.py |
|
3 | 3 | include ipython.py |
|
4 | 4 | include setupbase.py |
|
5 | 5 | |
|
6 | 6 | graft scripts |
|
7 | 7 | |
|
8 | 8 | graft setupext |
|
9 | 9 | |
|
10 | 10 | graft IPython/UserConfig |
|
11 | 11 | |
|
12 | 12 | graft IPython/kernel |
|
13 | 13 | graft IPython/config |
|
14 | 14 | graft IPython/testing |
|
15 | 15 | graft IPython/tools |
|
16 | 16 | |
|
17 | 17 | recursive-include IPython/Extensions igrid_help* |
|
18 | 18 | |
|
19 | 19 | graft docs |
|
20 | 20 | exclude docs/\#* |
|
21 | 21 | exclude docs/man/*.1 |
|
22 | 22 | |
|
23 | 23 | # docs subdirs we want to skip |
|
24 | 24 | prune docs/attic |
|
25 | 25 | prune docs/build |
|
26 | 26 | |
|
27 | 27 | global-exclude *~ |
|
28 | 28 | global-exclude *.flc |
|
29 | 29 | global-exclude *.pyc |
|
30 | 30 | global-exclude .dircopy.log |
|
31 | 31 | global-exclude .svn |
|
32 | 32 | global-exclude .bzr |
|
33 | global-exclude .hgignore |
|
1 | NO CONTENT: modified file chmod 100644 => 100755 |
@@ -1,85 +1,89 b'' | |||
|
1 | 1 | #!python |
|
2 | 2 | """Windows-specific part of the installation""" |
|
3 | 3 | |
|
4 | 4 | import os, sys, shutil |
|
5 | 5 | |
|
6 | 6 | def mkshortcut(target,description,link_file,*args,**kw): |
|
7 | 7 | """make a shortcut if it doesn't exist, and register its creation""" |
|
8 | 8 | |
|
9 | 9 | create_shortcut(target, description, link_file,*args,**kw) |
|
10 | 10 | file_created(link_file) |
|
11 | 11 | |
|
12 | 12 | def install(): |
|
13 | 13 | """Routine to be run by the win32 installer with the -install switch.""" |
|
14 | 14 | |
|
15 | 15 | from IPython.Release import version |
|
16 | 16 | |
|
17 | 17 | # Get some system constants |
|
18 | 18 | prefix = sys.prefix |
|
19 | 19 | python = prefix + r'\python.exe' |
|
20 | 20 | # Lookup path to common startmenu ... |
|
21 | 21 | ip_dir = get_special_folder_path('CSIDL_COMMON_PROGRAMS') + r'\IPython' |
|
22 | 22 | |
|
23 | 23 | # Some usability warnings at installation time. I don't want them at the |
|
24 | 24 | # top-level, so they don't appear if the user is uninstalling. |
|
25 | 25 | try: |
|
26 | 26 | import ctypes |
|
27 | 27 | except ImportError: |
|
28 | 28 | print ('To take full advantage of IPython, you need ctypes from:\n' |
|
29 | 29 | 'http://sourceforge.net/projects/ctypes') |
|
30 | 30 | |
|
31 | 31 | try: |
|
32 | 32 | import win32con |
|
33 | 33 | except ImportError: |
|
34 | 34 | print ('To take full advantage of IPython, you need pywin32 from:\n' |
|
35 | 35 | 'http://starship.python.net/crew/mhammond/win32/Downloads.html') |
|
36 | 36 | |
|
37 | 37 | try: |
|
38 | 38 | import readline |
|
39 | 39 | except ImportError: |
|
40 | 40 | print ('To take full advantage of IPython, you need readline from:\n' |
|
41 |
'http |
|
|
41 | 'https://launchpad.net/pyreadline') | |
|
42 | 42 | |
|
43 | 43 | ipybase = '"' + prefix + r'\scripts\ipython"' |
|
44 | 44 | # Create IPython entry ... |
|
45 | 45 | if not os.path.isdir(ip_dir): |
|
46 | 46 | os.mkdir(ip_dir) |
|
47 | 47 | directory_created(ip_dir) |
|
48 | 48 | |
|
49 | 49 | # Create program shortcuts ... |
|
50 | 50 | f = ip_dir + r'\IPython.lnk' |
|
51 | 51 | a = ipybase |
|
52 | 52 | mkshortcut(python,'IPython',f,a) |
|
53 | 53 | |
|
54 | 54 | f = ip_dir + r'\pysh.lnk' |
|
55 | 55 | a = ipybase+' -p sh' |
|
56 | mkshortcut(python,'IPython command prompt mode',f,a) | |
|
56 | mkshortcut(python,'IPython (command prompt mode)',f,a) | |
|
57 | ||
|
58 | f = ip_dir + r'\pylab.lnk' | |
|
59 | a = ipybase+' -pylab' | |
|
60 | mkshortcut(python,'IPython (PyLab mode)',f,a) | |
|
57 | 61 | |
|
58 | 62 | f = ip_dir + r'\scipy.lnk' |
|
59 | 63 | a = ipybase+' -pylab -p scipy' |
|
60 | mkshortcut(python,'IPython scipy profile',f,a) | |
|
64 | mkshortcut(python,'IPython (scipy profile)',f,a) | |
|
61 | 65 | |
|
62 | 66 | # Create documentation shortcuts ... |
|
63 | 67 | t = prefix + r'\share\doc\ipython\manual\ipython.pdf' |
|
64 | 68 | f = ip_dir + r'\Manual in PDF.lnk' |
|
65 | 69 | mkshortcut(t,r'IPython Manual - PDF-Format',f) |
|
66 | 70 | |
|
67 | 71 | t = prefix + r'\share\doc\ipython\manual\html\index.html' |
|
68 | 72 | f = ip_dir + r'\Manual in HTML.lnk' |
|
69 | 73 | mkshortcut(t,'IPython Manual - HTML-Format',f) |
|
70 | 74 | |
|
71 | 75 | # make ipython.py |
|
72 | 76 | shutil.copy(prefix + r'\scripts\ipython', prefix + r'\scripts\ipython.py') |
|
73 | 77 | |
|
74 | 78 | def remove(): |
|
75 | 79 | """Routine to be run by the win32 installer with the -remove switch.""" |
|
76 | 80 | pass |
|
77 | 81 | |
|
78 | 82 | # main() |
|
79 | 83 | if len(sys.argv) > 1: |
|
80 | 84 | if sys.argv[1] == '-install': |
|
81 | 85 | install() |
|
82 | 86 | elif sys.argv[1] == '-remove': |
|
83 | 87 | remove() |
|
84 | 88 | else: |
|
85 | 89 | print "Script was called with option %s" % sys.argv[1] |
@@ -1,277 +1,278 b'' | |||
|
1 | 1 | # encoding: utf-8 |
|
2 | 2 | |
|
3 | 3 | """ |
|
4 | 4 | This module defines the things that are used in setup.py for building IPython |
|
5 | 5 | |
|
6 | 6 | This includes: |
|
7 | 7 | |
|
8 | 8 | * The basic arguments to setup |
|
9 | 9 | * Functions for finding things like packages, package data, etc. |
|
10 | 10 | * A function for checking dependencies. |
|
11 | 11 | """ |
|
12 | 12 | |
|
13 | 13 | __docformat__ = "restructuredtext en" |
|
14 | 14 | |
|
15 | 15 | #------------------------------------------------------------------------------- |
|
16 | 16 | # Copyright (C) 2008 The IPython Development Team |
|
17 | 17 | # |
|
18 | 18 | # Distributed under the terms of the BSD License. The full license is in |
|
19 | 19 | # the file COPYING, distributed as part of this software. |
|
20 | 20 | #------------------------------------------------------------------------------- |
|
21 | 21 | |
|
22 | 22 | #------------------------------------------------------------------------------- |
|
23 | 23 | # Imports |
|
24 | 24 | #------------------------------------------------------------------------------- |
|
25 | 25 | |
|
26 | 26 | import os, sys |
|
27 | 27 | |
|
28 | 28 | from glob import glob |
|
29 | 29 | |
|
30 | 30 | from setupext import install_data_ext |
|
31 | 31 | |
|
32 | 32 | #------------------------------------------------------------------------------- |
|
33 | 33 | # Useful globals and utility functions |
|
34 | 34 | #------------------------------------------------------------------------------- |
|
35 | 35 | |
|
36 | 36 | # A few handy globals |
|
37 | 37 | isfile = os.path.isfile |
|
38 | 38 | pjoin = os.path.join |
|
39 | 39 | |
|
40 | 40 | def oscmd(s): |
|
41 | 41 | print ">", s |
|
42 | 42 | os.system(s) |
|
43 | 43 | |
|
44 | 44 | # A little utility we'll need below, since glob() does NOT allow you to do |
|
45 | 45 | # exclusion on multiple endings! |
|
46 | 46 | def file_doesnt_endwith(test,endings): |
|
47 | 47 | """Return true if test is a file and its name does NOT end with any |
|
48 | 48 | of the strings listed in endings.""" |
|
49 | 49 | if not isfile(test): |
|
50 | 50 | return False |
|
51 | 51 | for e in endings: |
|
52 | 52 | if test.endswith(e): |
|
53 | 53 | return False |
|
54 | 54 | return True |
|
55 | 55 | |
|
56 | 56 | #--------------------------------------------------------------------------- |
|
57 | 57 | # Basic project information |
|
58 | 58 | #--------------------------------------------------------------------------- |
|
59 | 59 | |
|
60 | 60 | # Release.py contains version, authors, license, url, keywords, etc. |
|
61 | 61 | execfile(pjoin('IPython','Release.py')) |
|
62 | 62 | |
|
63 | 63 | # Create a dict with the basic information |
|
64 | 64 | # This dict is eventually passed to setup after additional keys are added. |
|
65 | 65 | setup_args = dict( |
|
66 | 66 | name = name, |
|
67 | 67 | version = version, |
|
68 | 68 | description = description, |
|
69 | 69 | long_description = long_description, |
|
70 | 70 | author = author, |
|
71 | 71 | author_email = author_email, |
|
72 | 72 | url = url, |
|
73 | 73 | download_url = download_url, |
|
74 | 74 | license = license, |
|
75 | 75 | platforms = platforms, |
|
76 | 76 | keywords = keywords, |
|
77 | 77 | cmdclass = {'install_data': install_data_ext}, |
|
78 | 78 | ) |
|
79 | 79 | |
|
80 | 80 | |
|
81 | 81 | #--------------------------------------------------------------------------- |
|
82 | 82 | # Find packages |
|
83 | 83 | #--------------------------------------------------------------------------- |
|
84 | 84 | |
|
85 | 85 | def add_package(packages,pname,config=False,tests=False,scripts=False, |
|
86 | 86 | others=None): |
|
87 | 87 | """ |
|
88 | 88 | Add a package to the list of packages, including certain subpackages. |
|
89 | 89 | """ |
|
90 | 90 | packages.append('.'.join(['IPython',pname])) |
|
91 | 91 | if config: |
|
92 | 92 | packages.append('.'.join(['IPython',pname,'config'])) |
|
93 | 93 | if tests: |
|
94 | 94 | packages.append('.'.join(['IPython',pname,'tests'])) |
|
95 | 95 | if scripts: |
|
96 | 96 | packages.append('.'.join(['IPython',pname,'scripts'])) |
|
97 | 97 | if others is not None: |
|
98 | 98 | for o in others: |
|
99 | 99 | packages.append('.'.join(['IPython',pname,o])) |
|
100 | 100 | |
|
101 | 101 | def find_packages(): |
|
102 | 102 | """ |
|
103 | 103 | Find all of IPython's packages. |
|
104 | 104 | """ |
|
105 | 105 | packages = ['IPython'] |
|
106 | 106 | add_package(packages, 'config', tests=True) |
|
107 | 107 | add_package(packages , 'Extensions') |
|
108 | 108 | add_package(packages, 'external') |
|
109 | 109 | add_package(packages, 'gui') |
|
110 | 110 | add_package(packages, 'gui.wx') |
|
111 | 111 | add_package(packages, 'frontend', tests=True) |
|
112 | 112 | add_package(packages, 'frontend._process') |
|
113 | 113 | add_package(packages, 'frontend.wx') |
|
114 | 114 | add_package(packages, 'frontend.cocoa', tests=True) |
|
115 | 115 | add_package(packages, 'kernel', config=True, tests=True, scripts=True) |
|
116 | 116 | add_package(packages, 'kernel.core', config=True, tests=True) |
|
117 | 117 | add_package(packages, 'testing', tests=True) |
|
118 | 118 | add_package(packages, 'testing.plugin', tests=False) |
|
119 | 119 | add_package(packages, 'tools', tests=True) |
|
120 | 120 | add_package(packages, 'UserConfig') |
|
121 | 121 | return packages |
|
122 | 122 | |
|
123 | 123 | #--------------------------------------------------------------------------- |
|
124 | 124 | # Find package data |
|
125 | 125 | #--------------------------------------------------------------------------- |
|
126 | 126 | |
|
127 | 127 | def find_package_data(): |
|
128 | 128 | """ |
|
129 | 129 | Find IPython's package_data. |
|
130 | 130 | """ |
|
131 | 131 | # This is not enough for these things to appear in an sdist. |
|
132 | 132 | # We need to muck with the MANIFEST to get this to work |
|
133 | 133 | package_data = { |
|
134 | 134 | 'IPython.UserConfig' : ['*'], |
|
135 | 135 | 'IPython.tools.tests' : ['*.txt'], |
|
136 | 136 | 'IPython.testing' : ['*.txt'] |
|
137 | 137 | } |
|
138 | 138 | return package_data |
|
139 | 139 | |
|
140 | 140 | |
|
141 | 141 | #--------------------------------------------------------------------------- |
|
142 | 142 | # Find data files |
|
143 | 143 | #--------------------------------------------------------------------------- |
|
144 | 144 | |
|
145 | 145 | def make_dir_struct(tag,base,out_base): |
|
146 | 146 | """Make the directory structure of all files below a starting dir. |
|
147 | 147 | |
|
148 | 148 | This is just a convenience routine to help build a nested directory |
|
149 | 149 | hierarchy because distutils is too stupid to do this by itself. |
|
150 | 150 | |
|
151 | 151 | XXX - this needs a proper docstring! |
|
152 | 152 | """ |
|
153 | 153 | |
|
154 | 154 | # we'll use these a lot below |
|
155 | 155 | lbase = len(base) |
|
156 | 156 | pathsep = os.path.sep |
|
157 | 157 | lpathsep = len(pathsep) |
|
158 | 158 | |
|
159 | 159 | out = [] |
|
160 | 160 | for (dirpath,dirnames,filenames) in os.walk(base): |
|
161 | 161 | # we need to strip out the dirpath from the base to map it to the |
|
162 | 162 | # output (installation) path. This requires possibly stripping the |
|
163 | 163 | # path separator, because otherwise pjoin will not work correctly |
|
164 | 164 | # (pjoin('foo/','/bar') returns '/bar'). |
|
165 | 165 | |
|
166 | 166 | dp_eff = dirpath[lbase:] |
|
167 | 167 | if dp_eff.startswith(pathsep): |
|
168 | 168 | dp_eff = dp_eff[lpathsep:] |
|
169 | 169 | # The output path must be anchored at the out_base marker |
|
170 | 170 | out_path = pjoin(out_base,dp_eff) |
|
171 | 171 | # Now we can generate the final filenames. Since os.walk only produces |
|
172 | 172 | # filenames, we must join back with the dirpath to get full valid file |
|
173 | 173 | # paths: |
|
174 | 174 | pfiles = [pjoin(dirpath,f) for f in filenames] |
|
175 | 175 | # Finally, generate the entry we need, which is a triple of (tag,output |
|
176 | 176 | # path, files) for use as a data_files parameter in install_data. |
|
177 | 177 | out.append((tag,out_path,pfiles)) |
|
178 | 178 | |
|
179 | 179 | return out |
|
180 | 180 | |
|
181 | 181 | |
|
182 | 182 | def find_data_files(): |
|
183 | 183 | """ |
|
184 | 184 | Find IPython's data_files. |
|
185 | 185 | |
|
186 | 186 | Most of these are docs. |
|
187 | 187 | """ |
|
188 | 188 | |
|
189 | 189 | docdirbase = 'share/doc/ipython' |
|
190 | 190 | manpagebase = 'share/man/man1' |
|
191 | 191 | |
|
192 | 192 | # Simple file lists can be made by hand |
|
193 | 193 | manpages = filter(isfile, glob('docs/man/*.1.gz')) |
|
194 | 194 | igridhelpfiles = filter(isfile, glob('IPython/Extensions/igrid_help.*')) |
|
195 | 195 | |
|
196 | 196 | # For nested structures, use the utility above |
|
197 | 197 | example_files = make_dir_struct('data','docs/examples', |
|
198 | 198 | pjoin(docdirbase,'examples')) |
|
199 | 199 | manual_files = make_dir_struct('data','docs/dist',pjoin(docdirbase,'manual')) |
|
200 | 200 | |
|
201 | 201 | # And assemble the entire output list |
|
202 | 202 | data_files = [ ('data',manpagebase, manpages), |
|
203 | 203 | ('data',pjoin(docdirbase,'extensions'),igridhelpfiles), |
|
204 | 204 | ] + manual_files + example_files |
|
205 | 205 | |
|
206 | 206 | ## import pprint # dbg |
|
207 | 207 | ## print '*'*80 |
|
208 | 208 | ## print 'data files' |
|
209 | 209 | ## pprint.pprint(data_files) |
|
210 | 210 | ## print '*'*80 |
|
211 | 211 | |
|
212 | 212 | return data_files |
|
213 | 213 | |
|
214 | 214 | #--------------------------------------------------------------------------- |
|
215 | 215 | # Find scripts |
|
216 | 216 | #--------------------------------------------------------------------------- |
|
217 | 217 | |
|
218 | 218 | def find_scripts(): |
|
219 | 219 | """ |
|
220 | 220 | Find IPython's scripts. |
|
221 | 221 | """ |
|
222 | 222 | scripts = ['IPython/kernel/scripts/ipengine', |
|
223 | 223 | 'IPython/kernel/scripts/ipcontroller', |
|
224 | 224 | 'IPython/kernel/scripts/ipcluster', |
|
225 | 225 | 'scripts/ipython', |
|
226 | 226 | 'scripts/ipythonx', |
|
227 | 'scripts/ipython-wx', | |
|
227 | 228 | 'scripts/pycolor', |
|
228 | 229 | 'scripts/irunner', |
|
229 | 230 | 'scripts/iptest', |
|
230 | 231 | ] |
|
231 | 232 | |
|
232 | 233 | # Script to be run by the windows binary installer after the default setup |
|
233 | 234 | # routine, to add shortcuts and similar windows-only things. Windows |
|
234 | 235 | # post-install scripts MUST reside in the scripts/ dir, otherwise distutils |
|
235 | 236 | # doesn't find them. |
|
236 | 237 | if 'bdist_wininst' in sys.argv: |
|
237 | 238 | if len(sys.argv) > 2 and ('sdist' in sys.argv or 'bdist_rpm' in sys.argv): |
|
238 | 239 | print >> sys.stderr,"ERROR: bdist_wininst must be run alone. Exiting." |
|
239 | 240 | sys.exit(1) |
|
240 | 241 | scripts.append('scripts/ipython_win_post_install.py') |
|
241 | 242 | |
|
242 | 243 | return scripts |
|
243 | 244 | |
|
244 | 245 | #--------------------------------------------------------------------------- |
|
245 | 246 | # Verify all dependencies |
|
246 | 247 | #--------------------------------------------------------------------------- |
|
247 | 248 | |
|
248 | 249 | def check_for_dependencies(): |
|
249 | 250 | """Check for IPython's dependencies. |
|
250 | 251 | |
|
251 | 252 | This function should NOT be called if running under setuptools! |
|
252 | 253 | """ |
|
253 | 254 | from setupext.setupext import ( |
|
254 | 255 | print_line, print_raw, print_status, print_message, |
|
255 | 256 | check_for_zopeinterface, check_for_twisted, |
|
256 | 257 | check_for_foolscap, check_for_pyopenssl, |
|
257 | 258 | check_for_sphinx, check_for_pygments, |
|
258 | 259 | check_for_nose, check_for_pexpect |
|
259 | 260 | ) |
|
260 | 261 | print_line() |
|
261 | 262 | print_raw("BUILDING IPYTHON") |
|
262 | 263 | print_status('python', sys.version) |
|
263 | 264 | print_status('platform', sys.platform) |
|
264 | 265 | if sys.platform == 'win32': |
|
265 | 266 | print_status('Windows version', sys.getwindowsversion()) |
|
266 | 267 | |
|
267 | 268 | print_raw("") |
|
268 | 269 | print_raw("OPTIONAL DEPENDENCIES") |
|
269 | 270 | |
|
270 | 271 | check_for_zopeinterface() |
|
271 | 272 | check_for_twisted() |
|
272 | 273 | check_for_foolscap() |
|
273 | 274 | check_for_pyopenssl() |
|
274 | 275 | check_for_sphinx() |
|
275 | 276 | check_for_pygments() |
|
276 | 277 | check_for_nose() |
|
277 | 278 | check_for_pexpect() |
@@ -1,141 +1,141 b'' | |||
|
1 | 1 | #!python |
|
2 | 2 | """Windows-specific part of the installation""" |
|
3 | 3 | |
|
4 | 4 | import os, sys |
|
5 | 5 | |
|
6 | 6 | try: |
|
7 | 7 | import shutil,pythoncom |
|
8 | 8 | from win32com.shell import shell |
|
9 | 9 | import _winreg as wreg |
|
10 | 10 | except ImportError: |
|
11 | 11 | print """ |
|
12 | 12 | You seem to be missing the PythonWin extensions necessary for automatic |
|
13 | 13 | installation. You can get them (free) from |
|
14 | 14 | http://starship.python.net/crew/mhammond/ |
|
15 | 15 | |
|
16 | 16 | Please see the manual for details if you want to finish the installation by |
|
17 | 17 | hand, or get PythonWin and repeat the procedure. |
|
18 | 18 | |
|
19 | 19 | Press <Enter> to exit this installer.""" |
|
20 | 20 | raw_input() |
|
21 | 21 | sys.exit() |
|
22 | 22 | |
|
23 | 23 | |
|
24 | 24 | def make_shortcut(fname,target,args='',start_in='',comment='',icon=None): |
|
25 | 25 | """Make a Windows shortcut (.lnk) file. |
|
26 | 26 | |
|
27 | 27 | make_shortcut(fname,target,args='',start_in='',comment='',icon=None) |
|
28 | 28 | |
|
29 | 29 | Arguments: |
|
30 | 30 | fname - name of the final shortcut file (include the .lnk) |
|
31 | 31 | target - what the shortcut will point to |
|
32 | 32 | args - additional arguments to pass to the target program |
|
33 | 33 | start_in - directory where the target command will be called |
|
34 | 34 | comment - for the popup tooltips |
|
35 | 35 | icon - optional icon file. This must be a tuple of the type |
|
36 | 36 | (icon_file,index), where index is the index of the icon you want |
|
37 | 37 | in the file. For single .ico files, index=0, but for icon libraries |
|
38 | 38 | contained in a single file it can be >0. |
|
39 | 39 | """ |
|
40 | 40 | |
|
41 | 41 | shortcut = pythoncom.CoCreateInstance( |
|
42 | 42 | shell.CLSID_ShellLink, None, |
|
43 | 43 | pythoncom.CLSCTX_INPROC_SERVER, shell.IID_IShellLink |
|
44 | 44 | ) |
|
45 | 45 | shortcut.SetPath(target) |
|
46 | 46 | shortcut.SetArguments(args) |
|
47 | 47 | shortcut.SetWorkingDirectory(start_in) |
|
48 | 48 | shortcut.SetDescription(comment) |
|
49 | 49 | if icon: |
|
50 | 50 | shortcut.SetIconLocation(*icon) |
|
51 | 51 | shortcut.QueryInterface(pythoncom.IID_IPersistFile).Save(fname,0) |
|
52 | 52 | |
|
53 | 53 | |
|
54 | 54 | def run(wait=0): |
|
55 | 55 | # Find where the Start Menu and My Documents are on the filesystem |
|
56 | 56 | key = wreg.OpenKey(wreg.HKEY_CURRENT_USER, |
|
57 | 57 | r'Software\Microsoft\Windows\CurrentVersion' |
|
58 | 58 | r'\Explorer\Shell Folders') |
|
59 | 59 | |
|
60 | 60 | programs_dir = wreg.QueryValueEx(key,'Programs')[0] |
|
61 | 61 | my_documents_dir = wreg.QueryValueEx(key,'Personal')[0] |
|
62 | 62 | key.Close() |
|
63 | 63 | |
|
64 | 64 | # Find where the 'program files' directory is |
|
65 | 65 | key = wreg.OpenKey(wreg.HKEY_LOCAL_MACHINE, |
|
66 | 66 | r'SOFTWARE\Microsoft\Windows\CurrentVersion') |
|
67 | 67 | |
|
68 | 68 | program_files_dir = wreg.QueryValueEx(key,'ProgramFilesDir')[0] |
|
69 | 69 | key.Close() |
|
70 | 70 | |
|
71 | 71 | |
|
72 | 72 | # File and directory names |
|
73 | 73 | ip_dir = program_files_dir + r'\IPython' |
|
74 | 74 | ip_prog_dir = programs_dir + r'\IPython' |
|
75 | doc_dir = ip_dir+r'\doc' | |
|
75 | doc_dir = ip_dir+r'\docs' | |
|
76 | 76 | ip_filename = ip_dir+r'\IPython_shell.py' |
|
77 | 77 | pycon_icon = doc_dir+r'\pycon.ico' |
|
78 | 78 | |
|
79 | 79 | if not os.path.isdir(ip_dir): |
|
80 | 80 | os.mkdir(ip_dir) |
|
81 | 81 | |
|
82 | 82 | # Copy startup script and documentation |
|
83 | 83 | shutil.copy(sys.prefix+r'\Scripts\ipython',ip_filename) |
|
84 | 84 | if os.path.isdir(doc_dir): |
|
85 | 85 | shutil.rmtree(doc_dir) |
|
86 | shutil.copytree('doc',doc_dir) | |
|
86 | shutil.copytree('docs',doc_dir) | |
|
87 | 87 | |
|
88 | 88 | # make shortcuts for IPython, html and pdf docs. |
|
89 | 89 | print 'Making entries for IPython in Start Menu...', |
|
90 | 90 | |
|
91 | 91 | # Create .bat file in \Scripts |
|
92 | 92 | fic = open(sys.prefix + r'\Scripts\ipython.bat','w') |
|
93 | 93 | fic.write('"' + sys.prefix + r'\python.exe' + '" -i ' + '"' + |
|
94 | 94 | sys.prefix + r'\Scripts\ipython" %*') |
|
95 | 95 | fic.close() |
|
96 | 96 | |
|
97 | 97 | # Create .bat file in \\Scripts |
|
98 | 98 | fic = open(sys.prefix + '\\Scripts\\ipython.bat','w') |
|
99 | 99 | fic.write('"' + sys.prefix + '\\python.exe' + '" -i ' + '"' + sys.prefix + '\\Scripts\ipython" %*') |
|
100 | 100 | fic.close() |
|
101 | 101 | |
|
102 | 102 | # Create shortcuts in Programs\IPython: |
|
103 | 103 | if not os.path.isdir(ip_prog_dir): |
|
104 | 104 | os.mkdir(ip_prog_dir) |
|
105 | 105 | os.chdir(ip_prog_dir) |
|
106 | 106 | |
|
107 |
man_pdf = doc_dir + r'\ |
|
|
108 |
man_htm = doc_dir + r'\ |
|
|
107 | man_pdf = doc_dir + r'\dist\ipython.pdf' | |
|
108 | man_htm = doc_dir + r'\dist\index.html' | |
|
109 | 109 | |
|
110 | 110 | make_shortcut('IPython.lnk',sys.executable, '"%s"' % ip_filename, |
|
111 | 111 | my_documents_dir, |
|
112 | 112 | 'IPython - Enhanced python command line interpreter', |
|
113 | 113 | (pycon_icon,0)) |
|
114 | 114 | make_shortcut('pysh.lnk',sys.executable, '"%s" -p pysh' % ip_filename, |
|
115 | 115 | my_documents_dir, |
|
116 | 116 | 'pysh - a system shell with Python syntax (IPython based)', |
|
117 | 117 | (pycon_icon,0)) |
|
118 | 118 | make_shortcut('Manual in HTML format.lnk',man_htm,'','', |
|
119 | 119 | 'IPython Manual - HTML format') |
|
120 | 120 | make_shortcut('Manual in PDF format.lnk',man_pdf,'','', |
|
121 | 121 | 'IPython Manual - PDF format') |
|
122 | 122 | |
|
123 | 123 | print """Done. |
|
124 | 124 | |
|
125 | 125 | I created the directory %s. There you will find the |
|
126 | 126 | IPython startup script and manuals. |
|
127 | 127 | |
|
128 | 128 | An IPython menu was also created in your Start Menu, with entries for |
|
129 | 129 | IPython itself and the manual in HTML and PDF formats. |
|
130 | 130 | |
|
131 | 131 | For reading PDF documents you need the freely available Adobe Acrobat |
|
132 | 132 | Reader. If you don't have it, you can download it from: |
|
133 | 133 | http://www.adobe.com/products/acrobat/readstep2.html |
|
134 | 134 | """ % ip_dir |
|
135 | 135 | |
|
136 | 136 | if wait: |
|
137 | 137 | print "Finished with IPython installation. Press Enter to exit this installer.", |
|
138 | 138 | raw_input() |
|
139 | 139 | |
|
140 | 140 | if __name__ == '__main__': |
|
141 | 141 | run() |
General Comments 0
You need to be logged in to leave comments.
Login now