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