Show More
@@ -1,97 +1,100 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.core.release import version |
|
17 | 17 | |
|
18 | 18 | # Get some system constants |
|
19 | 19 | prefix = sys.prefix |
|
20 | 20 | python = pjoin(prefix, 'python.exe') |
|
21 | 21 | |
|
22 | 22 | # Lookup path to common startmenu ... |
|
23 | 23 | ip_start_menu = pjoin(get_special_folder_path('CSIDL_COMMON_PROGRAMS'), 'IPython') |
|
24 | 24 | # Create IPython entry ... |
|
25 | 25 | if not os.path.isdir(ip_start_menu): |
|
26 | 26 | os.mkdir(ip_start_menu) |
|
27 | 27 | directory_created(ip_start_menu) |
|
28 | 28 | |
|
29 | 29 | # Create .py and .bat files to make things available from |
|
30 | 30 | # the Windows command line. Thanks to the Twisted project |
|
31 | 31 | # for this logic! |
|
32 | 32 | programs = [ |
|
33 | 33 | 'ipython', |
|
34 | 34 | 'iptest', |
|
35 | 35 | 'ipcontroller', |
|
36 | 36 | 'ipengine', |
|
37 | 37 | 'ipcluster', |
|
38 | 38 | 'irunner' |
|
39 | 39 | ] |
|
40 | 40 | scripts = pjoin(prefix,'scripts') |
|
41 | 41 | for program in programs: |
|
42 | 42 | raw = pjoin(scripts, program) |
|
43 | 43 | bat = raw + '.bat' |
|
44 | 44 | py = raw + '.py' |
|
45 | 45 | # Create .py versions of the scripts |
|
46 | 46 | shutil.copy(raw, py) |
|
47 | 47 | # Create .bat files for each of the scripts |
|
48 | 48 | bat_file = file(bat,'w') |
|
49 | 49 | bat_file.write("@%s %s %%*" % (python, py)) |
|
50 | 50 | bat_file.close() |
|
51 | 51 | |
|
52 | 52 | # Now move onto setting the Start Menu up |
|
53 | 53 | ipybase = pjoin(scripts, 'ipython') |
|
54 | if 'setuptools' in sys.modules: | |
|
55 | # let setuptools take care of the scripts: | |
|
56 | ipybase = ipybase + '-script.py' | |
|
54 | 57 | workdir = "%HOMEDRIVE%%HOMEPATH%" |
|
55 | 58 | |
|
56 | 59 | link = pjoin(ip_start_menu, 'IPython.lnk') |
|
57 | 60 | cmd = '"%s"' % ipybase |
|
58 | 61 | mkshortcut(python, 'IPython', link, cmd, workdir) |
|
59 | 62 | |
|
60 | 63 | link = pjoin(ip_start_menu, 'pysh.lnk') |
|
61 | 64 | cmd = '"%s" -p sh' % ipybase |
|
62 | 65 | mkshortcut(python, 'IPython (command prompt mode)', link, cmd, workdir) |
|
63 | 66 | |
|
64 | 67 | link = pjoin(ip_start_menu, 'scipy.lnk') |
|
65 | 68 | cmd = '"%s" -p scipy' % ipybase |
|
66 | 69 | mkshortcut(python, 'IPython (scipy profile)', link, cmd, workdir) |
|
67 | 70 | |
|
68 | 71 | link = pjoin(ip_start_menu, 'ipcontroller.lnk') |
|
69 | 72 | cmd = '"%s" -xy' % pjoin(scripts, 'ipcontroller') |
|
70 | 73 | mkshortcut(python, 'IPython controller', link, cmd, workdir) |
|
71 | 74 | |
|
72 | 75 | link = pjoin(ip_start_menu, 'ipengine.lnk') |
|
73 | 76 | cmd = '"%s"' % pjoin(scripts, 'ipengine') |
|
74 | 77 | mkshortcut(python, 'IPython engine', link, cmd, workdir) |
|
75 | 78 | |
|
76 | 79 | # Create documentation shortcuts ... |
|
77 | 80 | t = prefix + r'\share\doc\ipython\manual\ipython.pdf' |
|
78 | 81 | f = ip_start_menu + r'\Manual in PDF.lnk' |
|
79 | 82 | mkshortcut(t,r'IPython Manual - PDF-Format',f) |
|
80 | 83 | |
|
81 | 84 | t = prefix + r'\share\doc\ipython\manual\html\index.html' |
|
82 | 85 | f = ip_start_menu + r'\Manual in HTML.lnk' |
|
83 | 86 | mkshortcut(t,'IPython Manual - HTML-Format',f) |
|
84 | 87 | |
|
85 | 88 | |
|
86 | 89 | def remove(): |
|
87 | 90 | """Routine to be run by the win32 installer with the -remove switch.""" |
|
88 | 91 | pass |
|
89 | 92 | |
|
90 | 93 | # main() |
|
91 | 94 | if len(sys.argv) > 1: |
|
92 | 95 | if sys.argv[1] == '-install': |
|
93 | 96 | install() |
|
94 | 97 | elif sys.argv[1] == '-remove': |
|
95 | 98 | remove() |
|
96 | 99 | else: |
|
97 | 100 | print "Script was called with option %s" % sys.argv[1] |
@@ -1,257 +1,255 b'' | |||
|
1 | 1 | #!/usr/bin/env python |
|
2 | 2 | # -*- coding: utf-8 -*- |
|
3 | 3 | """Setup script for IPython. |
|
4 | 4 | |
|
5 | 5 | Under Posix environments it works like a typical setup.py script. |
|
6 | 6 | Under Windows, the command sdist is not supported, since IPython |
|
7 | 7 | requires utilities which are not available under Windows.""" |
|
8 | 8 | |
|
9 | 9 | #----------------------------------------------------------------------------- |
|
10 | 10 | # Copyright (c) 2008-2010, IPython Development Team. |
|
11 | 11 | # Copyright (c) 2001-2007, Fernando Perez <fernando.perez@colorado.edu> |
|
12 | 12 | # Copyright (c) 2001, Janko Hauser <jhauser@zscout.de> |
|
13 | 13 | # Copyright (c) 2001, Nathaniel Gray <n8gray@caltech.edu> |
|
14 | 14 | # |
|
15 | 15 | # Distributed under the terms of the Modified BSD License. |
|
16 | 16 | # |
|
17 | 17 | # The full license is in the file COPYING.txt, distributed with this software. |
|
18 | 18 | #----------------------------------------------------------------------------- |
|
19 | 19 | |
|
20 | 20 | #----------------------------------------------------------------------------- |
|
21 | 21 | # Minimal Python version sanity check |
|
22 | 22 | #----------------------------------------------------------------------------- |
|
23 | 23 | |
|
24 | 24 | import sys |
|
25 | 25 | |
|
26 | 26 | # This check is also made in IPython/__init__, don't forget to update both when |
|
27 | 27 | # changing Python version requirements. |
|
28 | 28 | if sys.version[0:3] < '2.6': |
|
29 | 29 | error = """\ |
|
30 | 30 | ERROR: 'IPython requires Python Version 2.6 or above.' |
|
31 | 31 | Exiting.""" |
|
32 | 32 | print >> sys.stderr, error |
|
33 | 33 | sys.exit(1) |
|
34 | 34 | |
|
35 | 35 | # At least we're on the python version we need, move on. |
|
36 | 36 | |
|
37 | 37 | #------------------------------------------------------------------------------- |
|
38 | 38 | # Imports |
|
39 | 39 | #------------------------------------------------------------------------------- |
|
40 | 40 | |
|
41 | 41 | # Stdlib imports |
|
42 | 42 | import os |
|
43 | 43 | import shutil |
|
44 | 44 | |
|
45 | 45 | from glob import glob |
|
46 | 46 | |
|
47 | 47 | # BEFORE importing distutils, remove MANIFEST. distutils doesn't properly |
|
48 | 48 | # update it when the contents of directories change. |
|
49 | 49 | if os.path.exists('MANIFEST'): os.remove('MANIFEST') |
|
50 | 50 | |
|
51 | 51 | from distutils.core import setup |
|
52 | 52 | |
|
53 | 53 | # Our own imports |
|
54 | 54 | from IPython.utils.path import target_update |
|
55 | 55 | |
|
56 | 56 | from setupbase import ( |
|
57 | 57 | setup_args, |
|
58 | 58 | find_packages, |
|
59 | 59 | find_package_data, |
|
60 | 60 | find_scripts, |
|
61 | 61 | find_data_files, |
|
62 | 62 | check_for_dependencies, |
|
63 | 63 | record_commit_info, |
|
64 | 64 | ) |
|
65 | 65 | |
|
66 | 66 | isfile = os.path.isfile |
|
67 | 67 | pjoin = os.path.join |
|
68 | 68 | |
|
69 | 69 | #----------------------------------------------------------------------------- |
|
70 | 70 | # Function definitions |
|
71 | 71 | #----------------------------------------------------------------------------- |
|
72 | 72 | |
|
73 | 73 | def cleanup(): |
|
74 | 74 | """Clean up the junk left around by the build process""" |
|
75 | 75 | if "develop" not in sys.argv: |
|
76 | 76 | try: |
|
77 | 77 | shutil.rmtree('ipython.egg-info') |
|
78 | 78 | except: |
|
79 | 79 | try: |
|
80 | 80 | os.unlink('ipython.egg-info') |
|
81 | 81 | except: |
|
82 | 82 | pass |
|
83 | 83 | |
|
84 | 84 | #------------------------------------------------------------------------------- |
|
85 | 85 | # Handle OS specific things |
|
86 | 86 | #------------------------------------------------------------------------------- |
|
87 | 87 | |
|
88 | 88 | if os.name == 'posix': |
|
89 | 89 | os_name = 'posix' |
|
90 | 90 | elif os.name in ['nt','dos']: |
|
91 | 91 | os_name = 'windows' |
|
92 | 92 | else: |
|
93 | 93 | print 'Unsupported operating system:',os.name |
|
94 | 94 | sys.exit(1) |
|
95 | 95 | |
|
96 | 96 | # Under Windows, 'sdist' has not been supported. Now that the docs build with |
|
97 | 97 | # Sphinx it might work, but let's not turn it on until someone confirms that it |
|
98 | 98 | # actually works. |
|
99 | 99 | if os_name == 'windows' and 'sdist' in sys.argv: |
|
100 | 100 | print 'The sdist command is not available under Windows. Exiting.' |
|
101 | 101 | sys.exit(1) |
|
102 | 102 | |
|
103 | 103 | #------------------------------------------------------------------------------- |
|
104 | 104 | # Things related to the IPython documentation |
|
105 | 105 | #------------------------------------------------------------------------------- |
|
106 | 106 | |
|
107 | 107 | # update the manuals when building a source dist |
|
108 | 108 | if len(sys.argv) >= 2 and sys.argv[1] in ('sdist','bdist_rpm'): |
|
109 | 109 | import textwrap |
|
110 | 110 | |
|
111 | 111 | # List of things to be updated. Each entry is a triplet of args for |
|
112 | 112 | # target_update() |
|
113 | 113 | to_update = [ |
|
114 | 114 | # FIXME - Disabled for now: we need to redo an automatic way |
|
115 | 115 | # of generating the magic info inside the rst. |
|
116 | 116 | #('docs/magic.tex', |
|
117 | 117 | #['IPython/Magic.py'], |
|
118 | 118 | #"cd doc && ./update_magic.sh" ), |
|
119 | 119 | |
|
120 | 120 | ('docs/man/ipcluster.1.gz', |
|
121 | 121 | ['docs/man/ipcluster.1'], |
|
122 | 122 | 'cd docs/man && gzip -9c ipcluster.1 > ipcluster.1.gz'), |
|
123 | 123 | |
|
124 | 124 | ('docs/man/ipcontroller.1.gz', |
|
125 | 125 | ['docs/man/ipcontroller.1'], |
|
126 | 126 | 'cd docs/man && gzip -9c ipcontroller.1 > ipcontroller.1.gz'), |
|
127 | 127 | |
|
128 | 128 | ('docs/man/ipengine.1.gz', |
|
129 | 129 | ['docs/man/ipengine.1'], |
|
130 | 130 | 'cd docs/man && gzip -9c ipengine.1 > ipengine.1.gz'), |
|
131 | 131 | |
|
132 | 132 | ('docs/man/ipython.1.gz', |
|
133 | 133 | ['docs/man/ipython.1'], |
|
134 | 134 | 'cd docs/man && gzip -9c ipython.1 > ipython.1.gz'), |
|
135 | 135 | |
|
136 | 136 | ('docs/man/ipython-wx.1.gz', |
|
137 | 137 | ['docs/man/ipython-wx.1'], |
|
138 | 138 | 'cd docs/man && gzip -9c ipython-wx.1 > ipython-wx.1.gz'), |
|
139 | 139 | |
|
140 | 140 | ('docs/man/ipythonx.1.gz', |
|
141 | 141 | ['docs/man/ipythonx.1'], |
|
142 | 142 | 'cd docs/man && gzip -9c ipythonx.1 > ipythonx.1.gz'), |
|
143 | 143 | |
|
144 | 144 | ('docs/man/irunner.1.gz', |
|
145 | 145 | ['docs/man/irunner.1'], |
|
146 | 146 | 'cd docs/man && gzip -9c irunner.1 > irunner.1.gz'), |
|
147 | 147 | |
|
148 | 148 | ('docs/man/pycolor.1.gz', |
|
149 | 149 | ['docs/man/pycolor.1'], |
|
150 | 150 | 'cd docs/man && gzip -9c pycolor.1 > pycolor.1.gz'), |
|
151 | 151 | ] |
|
152 | 152 | |
|
153 | 153 | # Only build the docs if sphinx is present |
|
154 | 154 | try: |
|
155 | 155 | import sphinx |
|
156 | 156 | except ImportError: |
|
157 | 157 | pass |
|
158 | 158 | else: |
|
159 | 159 | # The Makefile calls the do_sphinx scripts to build html and pdf, so |
|
160 | 160 | # just one target is enough to cover all manual generation |
|
161 | 161 | |
|
162 | 162 | # First, compute all the dependencies that can force us to rebuild the |
|
163 | 163 | # docs. Start with the main release file that contains metadata |
|
164 | 164 | docdeps = ['IPython/core/release.py'] |
|
165 | 165 | # Inculde all the reST sources |
|
166 | 166 | pjoin = os.path.join |
|
167 | 167 | for dirpath,dirnames,filenames in os.walk('docs/source'): |
|
168 | 168 | if dirpath in ['_static','_templates']: |
|
169 | 169 | continue |
|
170 | 170 | docdeps += [ pjoin(dirpath,f) for f in filenames |
|
171 | 171 | if f.endswith('.txt') ] |
|
172 | 172 | # and the examples |
|
173 | 173 | for dirpath,dirnames,filenames in os.walk('docs/example'): |
|
174 | 174 | docdeps += [ pjoin(dirpath,f) for f in filenames |
|
175 | 175 | if not f.endswith('~') ] |
|
176 | 176 | # then, make them all dependencies for the main PDF (the html will get |
|
177 | 177 | # auto-generated as well). |
|
178 | 178 | to_update.append( |
|
179 | 179 | ('docs/dist/ipython.pdf', |
|
180 | 180 | docdeps, |
|
181 | 181 | "cd docs && make dist") |
|
182 | 182 | ) |
|
183 | 183 | |
|
184 | 184 | [ target_update(*t) for t in to_update ] |
|
185 | 185 | |
|
186 | 186 | #--------------------------------------------------------------------------- |
|
187 | 187 | # Find all the packages, package data, scripts and data_files |
|
188 | 188 | #--------------------------------------------------------------------------- |
|
189 | 189 | |
|
190 | 190 | packages = find_packages() |
|
191 | 191 | package_data = find_package_data() |
|
192 | 192 | scripts = find_scripts() |
|
193 | 193 | data_files = find_data_files() |
|
194 | 194 | |
|
195 | 195 | #--------------------------------------------------------------------------- |
|
196 | 196 | # Handle dependencies and setuptools specific things |
|
197 | 197 | #--------------------------------------------------------------------------- |
|
198 | 198 | |
|
199 | 199 | # For some commands, use setuptools. Note that we do NOT list install here! |
|
200 | 200 | # If you want a setuptools-enhanced install, just run 'setupegg.py install' |
|
201 | 201 | if len(set(('develop', 'sdist', 'release', 'bdist_egg', 'bdist_rpm', |
|
202 | 202 | 'bdist', 'bdist_dumb', 'bdist_wininst', 'install_egg_info', |
|
203 | 203 | 'build_sphinx', 'egg_info', 'easy_install', 'upload', |
|
204 | 204 | )).intersection(sys.argv)) > 0: |
|
205 | 205 | import setuptools |
|
206 | 206 | |
|
207 | 207 | # This dict is used for passing extra arguments that are setuptools |
|
208 | 208 | # specific to setup |
|
209 | 209 | setuptools_extra_args = {} |
|
210 | 210 | |
|
211 | 211 | if 'setuptools' in sys.modules: |
|
212 | 212 | setuptools_extra_args['zip_safe'] = False |
|
213 | 213 | setuptools_extra_args['entry_points'] = { |
|
214 | 214 | 'console_scripts': [ |
|
215 | 215 | 'ipython = IPython.frontend.terminal.ipapp:launch_new_instance', |
|
216 | 216 | 'ipython-qtconsole = IPython.frontend.qt.console.ipythonqt:main', |
|
217 | 217 | 'pycolor = IPython.utils.PyColorize:main', |
|
218 | 218 | 'ipcontroller = IPython.kernel.ipcontrollerapp:launch_new_instance', |
|
219 | 219 | 'ipengine = IPython.kernel.ipengineapp:launch_new_instance', |
|
220 | 220 | 'ipcluster = IPython.kernel.ipclusterapp:launch_new_instance', |
|
221 | 221 | 'iptest = IPython.testing.iptest:main', |
|
222 | 222 | 'irunner = IPython.lib.irunner:main' |
|
223 | 223 | ] |
|
224 | 224 | } |
|
225 | 225 | setup_args['extras_require'] = dict( |
|
226 | 226 | kernel = [ |
|
227 | 227 | 'zope.interface>=3.4.1', |
|
228 | 228 | 'Twisted>=8.0.1', |
|
229 | 229 | 'foolscap>=0.2.6' |
|
230 | 230 | ], |
|
231 | 231 | doc='Sphinx>=0.3', |
|
232 | 232 | test='nose>=0.10.1', |
|
233 | 233 | security='pyOpenSSL>=0.6' |
|
234 | 234 | ) |
|
235 | # Allow setuptools to handle the scripts | |
|
236 | scripts = [] | |
|
237 | 235 | else: |
|
238 | 236 | # If we are running without setuptools, call this function which will |
|
239 | 237 | # check for dependencies an inform the user what is needed. This is |
|
240 | 238 | # just to make life easy for users. |
|
241 | 239 | check_for_dependencies() |
|
242 | 240 | |
|
243 | 241 | #--------------------------------------------------------------------------- |
|
244 | 242 | # Do the actual setup now |
|
245 | 243 | #--------------------------------------------------------------------------- |
|
246 | 244 | |
|
247 | 245 | setup_args['cmdclass'] = {'build_py': record_commit_info('IPython')} |
|
248 | 246 | setup_args['packages'] = packages |
|
249 | 247 | setup_args['package_data'] = package_data |
|
250 | 248 | setup_args['scripts'] = scripts |
|
251 | 249 | setup_args['data_files'] = data_files |
|
252 | 250 | setup_args.update(setuptools_extra_args) |
|
253 | 251 | |
|
254 | 252 | |
|
255 | 253 | if __name__ == '__main__': |
|
256 | 254 | setup(**setup_args) |
|
257 | 255 | cleanup() |
|
1 | NO CONTENT: modified file |
General Comments 0
You need to be logged in to leave comments.
Login now