##// END OF EJS Templates
More work fixing some small bugs in the setup.py infrastructure. It is almost working!
Brian E Granger -
Show More
@@ -1,162 +1,165 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 The IPython Development Team
10 # Copyright (C) 2008 The IPython Development Team
11 #
11 #
12 # Distributed under the terms of the BSD License. The full license is in
12 # Distributed under the terms of the BSD License. The full license is in
13 # the file COPYING, distributed as part of this software.
13 # the file COPYING, distributed as part of this software.
14 #-------------------------------------------------------------------------------
14 #-------------------------------------------------------------------------------
15
15
16 #-------------------------------------------------------------------------------
16 #-------------------------------------------------------------------------------
17 # Imports
17 # Imports
18 #-------------------------------------------------------------------------------
18 #-------------------------------------------------------------------------------
19
19
20 # Stdlib imports
20 # Stdlib imports
21 import os
21 import os
22 import sys
22 import sys
23
23
24 from glob import glob
24 from glob import glob
25
25
26 # BEFORE importing distutils, remove MANIFEST. distutils doesn't properly
26 # BEFORE importing distutils, remove MANIFEST. distutils doesn't properly
27 # update it when the contents of directories change.
27 # update it when the contents of directories change.
28 if os.path.exists('MANIFEST'): os.remove('MANIFEST')
28 if os.path.exists('MANIFEST'): os.remove('MANIFEST')
29
29
30 from distutils.core import setup
30 from distutils.core import setup
31
31
32 # Local imports
32 # Local imports
33 from IPython.genutils import target_update
33 from IPython.genutils import target_update
34
34
35 from setupbase import (
35 from setupbase import (
36 setup_args,
36 setup_args,
37 find_packages,
37 find_packages,
38 find_package_data,
38 find_package_data,
39 find_scripts,
39 find_scripts,
40 find_data_files,
40 find_data_files,
41 check_for_dependencies
41 check_for_dependencies
42 )
42 )
43
43
44 isfile = os.path.isfile
44 isfile = os.path.isfile
45
45
46 #-------------------------------------------------------------------------------
46 #-------------------------------------------------------------------------------
47 # Handle OS specific things
47 # Handle OS specific things
48 #-------------------------------------------------------------------------------
48 #-------------------------------------------------------------------------------
49
49
50 if os.name == 'posix':
50 if os.name == 'posix':
51 os_name = 'posix'
51 os_name = 'posix'
52 elif os.name in ['nt','dos']:
52 elif os.name in ['nt','dos']:
53 os_name = 'windows'
53 os_name = 'windows'
54 else:
54 else:
55 print 'Unsupported operating system:',os.name
55 print 'Unsupported operating system:',os.name
56 sys.exit(1)
56 sys.exit(1)
57
57
58 # Under Windows, 'sdist' has not been supported. Now that the docs build with
58 # Under Windows, 'sdist' has not been supported. Now that the docs build with
59 # Sphinx it might work, but let's not turn it on until someone confirms that it
59 # Sphinx it might work, but let's not turn it on until someone confirms that it
60 # actually works.
60 # actually works.
61 if os_name == 'windows' and 'sdist' in sys.argv:
61 if os_name == 'windows' and 'sdist' in sys.argv:
62 print 'The sdist command is not available under Windows. Exiting.'
62 print 'The sdist command is not available under Windows. Exiting.'
63 sys.exit(1)
63 sys.exit(1)
64
64
65 #-------------------------------------------------------------------------------
65 #-------------------------------------------------------------------------------
66 # Things related to the IPython documentation
66 # Things related to the IPython documentation
67 #-------------------------------------------------------------------------------
67 #-------------------------------------------------------------------------------
68
68
69 # update the manuals when building a source dist
69 # update the manuals when building a source dist
70 if len(sys.argv) >= 2 and sys.argv[1] in ('sdist','bdist_rpm'):
70 if len(sys.argv) >= 2 and sys.argv[1] in ('sdist','bdist_rpm'):
71 import textwrap
71 import textwrap
72
72
73 # List of things to be updated. Each entry is a triplet of args for
73 # List of things to be updated. Each entry is a triplet of args for
74 # target_update()
74 # target_update()
75 to_update = [ # The do_sphinx scripts builds html and pdf, so just one
75 to_update = [ # The do_sphinx scripts builds html and pdf, so just one
76 # target is enough to cover all manual generation
76 # target is enough to cover all manual generation
77 ('doc/manual/ipython.pdf',
77 ('doc/manual/ipython.pdf',
78 ['IPython/Release.py','doc/source/ipython.rst'],
78 ['IPython/Release.py','doc/source/ipython.rst'],
79 "cd doc && python do_sphinx.py" ),
79 "cd doc && python do_sphinx.py" ),
80
80
81 # FIXME - Disabled for now: we need to redo an automatic way
81 # FIXME - Disabled for now: we need to redo an automatic way
82 # of generating the magic info inside the rst.
82 # of generating the magic info inside the rst.
83 #('doc/magic.tex',
83 #('doc/magic.tex',
84 #['IPython/Magic.py'],
84 #['IPython/Magic.py'],
85 #"cd doc && ./update_magic.sh" ),
85 #"cd doc && ./update_magic.sh" ),
86
86
87 ('doc/ipython.1.gz',
87 ('doc/ipython.1.gz',
88 ['doc/ipython.1'],
88 ['doc/ipython.1'],
89 "cd doc && gzip -9c ipython.1 > ipython.1.gz"),
89 "cd doc && gzip -9c ipython.1 > ipython.1.gz"),
90
90
91 ('doc/pycolor.1.gz',
91 ('doc/pycolor.1.gz',
92 ['doc/pycolor.1'],
92 ['doc/pycolor.1'],
93 "cd doc && gzip -9c pycolor.1 > pycolor.1.gz"),
93 "cd doc && gzip -9c pycolor.1 > pycolor.1.gz"),
94 ]
94 ]
95
95
96 [ target_update(*t) for t in to_update ]
96 [ target_update(*t) for t in to_update ]
97
97
98 #---------------------------------------------------------------------------
98 #---------------------------------------------------------------------------
99 # Find all the packages, package data, scripts and data_files
99 # Find all the packages, package data, scripts and data_files
100 #---------------------------------------------------------------------------
100 #---------------------------------------------------------------------------
101
101
102 packages = find_packages()
102 packages = find_packages()
103 package_data = find_package_data()
103 package_data = find_package_data()
104 scripts = find_scripts()
104 scripts = find_scripts()
105 data_files = find_data_files()
105 data_files = find_data_files()
106
106
107 #---------------------------------------------------------------------------
107 #---------------------------------------------------------------------------
108 # Handle dependencies and setuptools specific things
108 # Handle dependencies and setuptools specific things
109 #---------------------------------------------------------------------------
109 #---------------------------------------------------------------------------
110
110
111 # This dict is used for passing extra arguments that are setuptools
111 # This dict is used for passing extra arguments that are setuptools
112 # specific to setup
112 # specific to setup
113 setuptools_extra_args = {}
113 setuptools_extra_args = {}
114
114
115 if 'setuptools' in sys.modules:
115 if 'setuptools' in sys.modules:
116 setuptools_extra_args['zip_safe'] = False
116 setuptools_extra_args['zip_safe'] = False
117 setuptools_extra_args['entry_points'] = {
117 setuptools_extra_args['entry_points'] = {
118 'console_scripts': [
118 'console_scripts': [
119 'ipython = IPython.ipapi:launch_new_instance',
119 'ipython = IPython.ipapi:launch_new_instance',
120 'pycolor = IPython.PyColorize:main',
120 'pycolor = IPython.PyColorize:main',
121 'ipcontroller = IPython.kernel.scripts.ipcontroller:main',
121 'ipcontroller = IPython.kernel.scripts.ipcontroller:main',
122 'ipengine = IPython.kernel.scripts.ipengine:main',
122 'ipengine = IPython.kernel.scripts.ipengine:main',
123 'ipcluster = IPython.kernel.scripts.ipcluster:main'
123 'ipcluster = IPython.kernel.scripts.ipcluster:main'
124 ]
124 ]
125 }
125 }
126 setup_args["extras_require"] = dict(
126 setup_args["extras_require"] = dict(
127 kernel = [
127 kernel = [
128 "zope.interface>=3.4.1",
128 "zope.interface>=3.4.1",
129 "Twisted>=8.0.1",
129 "Twisted>=8.0.1",
130 "foolscap>=0.2.6"
130 "foolscap>=0.2.6"
131 ],
131 ],
132 doc=['Sphinx>=0.3','pygments'],
132 doc=['Sphinx>=0.3','pygments'],
133 test='nose>=0.10.1',
133 test='nose>=0.10.1',
134 security=["pyOpenSSL>=0.6"]
134 security=["pyOpenSSL>=0.6"]
135 )
135 )
136 # Allow setuptools to handle the scripts
136 # Allow setuptools to handle the scripts
137 scripts = []
137 scripts = []
138 # eggs will lack docs, examples
138 # eggs will lack docs, examples
139 data_files = []
139 data_files = []
140 else:
140 else:
141 # package_data of setuptools was introduced to distutils in 2.4
141 # package_data of setuptools was introduced to distutils in 2.4
142 cfgfiles = filter(isfile, glob('IPython/UserConfig/*'))
142 cfgfiles = filter(isfile, glob('IPython/UserConfig/*'))
143 if sys.version_info < (2,4):
143 if sys.version_info < (2,4):
144 data_files.append(('lib', 'IPython/UserConfig', cfgfiles))
144 data_files.append(('lib', 'IPython/UserConfig', cfgfiles))
145 # If we are running without setuptools, call this function which will
145 # If we are running without setuptools, call this function which will
146 # check for dependencies an inform the user what is needed. This is
146 # check for dependencies an inform the user what is needed. This is
147 # just to make life easy for users.
147 # just to make life easy for users.
148 check_for_dependencies()
148 check_for_dependencies()
149
149
150
150
151 #---------------------------------------------------------------------------
151 #---------------------------------------------------------------------------
152 # Do the actual setup now
152 # Do the actual setup now
153 #---------------------------------------------------------------------------
153 #---------------------------------------------------------------------------
154
154
155 print packages
156
157
155 setup_args['packages'] = packages
158 setup_args['packages'] = packages
156 setup_args['package_data'] = package_data
159 setup_args['package_data'] = package_data
157 setup_args['scripts'] = scripts
160 setup_args['scripts'] = scripts
158 setup_args['data_files'] = data_files
161 setup_args['data_files'] = data_files
159 setup_args.update(setuptools_extra_args)
162 setup_args.update(setuptools_extra_args)
160
163
161 if __name__ == '__main__':
164 if __name__ == '__main__':
162 setup(**setup_args)
165 setup(**setup_args)
@@ -1,230 +1,230 b''
1 # encoding: utf-8
1 # encoding: utf-8
2
2
3 """
3 """
4 This module defines the things that are used in setup.py for building IPython
4 This module defines the things that are used in setup.py for building IPython
5
5
6 This includes:
6 This includes:
7
7
8 * The basic arguments to setup
8 * The basic arguments to setup
9 * Functions for finding things like packages, package data, etc.
9 * Functions for finding things like packages, package data, etc.
10 * A function for checking dependencies.
10 * A function for checking dependencies.
11 """
11 """
12
12
13 __docformat__ = "restructuredtext en"
13 __docformat__ = "restructuredtext en"
14
14
15 #-------------------------------------------------------------------------------
15 #-------------------------------------------------------------------------------
16 # Copyright (C) 2008 The IPython Development Team
16 # Copyright (C) 2008 The IPython Development Team
17 #
17 #
18 # Distributed under the terms of the BSD License. The full license is in
18 # Distributed under the terms of the BSD License. The full license is in
19 # the file COPYING, distributed as part of this software.
19 # the file COPYING, distributed as part of this software.
20 #-------------------------------------------------------------------------------
20 #-------------------------------------------------------------------------------
21
21
22 #-------------------------------------------------------------------------------
22 #-------------------------------------------------------------------------------
23 # Imports
23 # Imports
24 #-------------------------------------------------------------------------------
24 #-------------------------------------------------------------------------------
25
25
26 import os, sys
26 import os, sys
27
27
28 from glob import glob
28 from glob import glob
29
29
30 from setupext import install_data_ext
30 from setupext import install_data_ext
31
31
32 #-------------------------------------------------------------------------------
32 #-------------------------------------------------------------------------------
33 # Useful globals and utility functions
33 # Useful globals and utility functions
34 #-------------------------------------------------------------------------------
34 #-------------------------------------------------------------------------------
35
35
36 # A few handy globals
36 # A few handy globals
37 isfile = os.path.isfile
37 isfile = os.path.isfile
38 pjoin = os.path.join
38 pjoin = os.path.join
39
39
40 def oscmd(s):
40 def oscmd(s):
41 print ">", s
41 print ">", s
42 os.system(s)
42 os.system(s)
43
43
44 # A little utility we'll need below, since glob() does NOT allow you to do
44 # A little utility we'll need below, since glob() does NOT allow you to do
45 # exclusion on multiple endings!
45 # exclusion on multiple endings!
46 def file_doesnt_endwith(test,endings):
46 def file_doesnt_endwith(test,endings):
47 """Return true if test is a file and its name does NOT end with any
47 """Return true if test is a file and its name does NOT end with any
48 of the strings listed in endings."""
48 of the strings listed in endings."""
49 if not isfile(test):
49 if not isfile(test):
50 return False
50 return False
51 for e in endings:
51 for e in endings:
52 if test.endswith(e):
52 if test.endswith(e):
53 return False
53 return False
54 return True
54 return True
55
55
56 #---------------------------------------------------------------------------
56 #---------------------------------------------------------------------------
57 # Basic project information
57 # Basic project information
58 #---------------------------------------------------------------------------
58 #---------------------------------------------------------------------------
59
59
60 # Release.py contains version, authors, license, url, keywords, etc.
60 # Release.py contains version, authors, license, url, keywords, etc.
61 execfile(pjoin('IPython','Release.py'))
61 execfile(pjoin('IPython','Release.py'))
62
62
63 # Create a dict with the basic information
63 # Create a dict with the basic information
64 # This dict is eventually passed to setup after additional keys are added.
64 # This dict is eventually passed to setup after additional keys are added.
65 setup_args = dict(
65 setup_args = dict(
66 name = name,
66 name = name,
67 version = version,
67 version = version,
68 description = description,
68 description = description,
69 long_description = long_description,
69 long_description = long_description,
70 author = author,
70 author = author,
71 author_email = author_email,
71 author_email = author_email,
72 url = url,
72 url = url,
73 download_url = download_url,
73 download_url = download_url,
74 license = license,
74 license = license,
75 platforms = platforms,
75 platforms = platforms,
76 keywords = keywords,
76 keywords = keywords,
77 cmdclass = {'install_data': install_data_ext},
77 cmdclass = {'install_data': install_data_ext},
78 )
78 )
79
79
80
80
81 #---------------------------------------------------------------------------
81 #---------------------------------------------------------------------------
82 # Find packages
82 # Find packages
83 #---------------------------------------------------------------------------
83 #---------------------------------------------------------------------------
84
84
85 def add_package(packages, pname, config=False, tests=False, scripts=False, others=None):
85 def add_package(packages, pname, config=False, tests=False, scripts=False, others=None):
86 """
86 """
87 Add a package to the list of packages, including certain subpackages.
87 Add a package to the list of packages, including certain subpackages.
88 """
88 """
89 packages.append('.'.join(['ipython1',pname]))
89 packages.append('.'.join(['IPython',pname]))
90 if config:
90 if config:
91 packages.append('.'.join(['ipython1',pname,'config']))
91 packages.append('.'.join(['IPython',pname,'config']))
92 if tests:
92 if tests:
93 packages.append('.'.join(['ipython1',pname,'tests']))
93 packages.append('.'.join(['IPython',pname,'tests']))
94 if scripts:
94 if scripts:
95 packages.append('.'.join(['ipython1',pname,'scripts']))
95 packages.append('.'.join(['IPython',pname,'scripts']))
96 if others is not None:
96 if others is not None:
97 for o in others:
97 for o in others:
98 packages.append('.'.join(['ipython1',pname,o]))
98 packages.append('.'.join(['IPython',pname,o]))
99
99
100 def find_packages():
100 def find_packages():
101 """
101 """
102 Find all of IPython's packages.
102 Find all of IPython's packages.
103 """
103 """
104 packages = ['ipython']
104 packages = ['IPython']
105 add_package(packages, 'config', tests=True)
105 add_package(packages, 'config', tests=True)
106 add_package(packages , 'Extensions')
106 add_package(packages , 'Extensions')
107 add_package(packages, 'external')
107 add_package(packages, 'external')
108 add_package(packages, 'gui')
108 add_package(packages, 'gui')
109 add_package(packages, 'gui.wx')
109 add_package(packages, 'gui.wx')
110 add_package(packages, 'kernel', config=True, tests=True, scripts=True)
110 add_package(packages, 'kernel', config=True, tests=True, scripts=True)
111 add_package(packages, 'kernel.core', config=True, tests=True)
111 add_package(packages, 'kernel.core', config=True, tests=True)
112 add_package(packages, 'testing', tests=True)
112 add_package(packages, 'testing', tests=True)
113 add_package(packages, 'tools', tests=True)
113 add_package(packages, 'tools', tests=True)
114 add_package(packages, 'UserConfig')
114 add_package(packages, 'UserConfig')
115 return packages
115 return packages
116
116
117 #---------------------------------------------------------------------------
117 #---------------------------------------------------------------------------
118 # Find package data
118 # Find package data
119 #---------------------------------------------------------------------------
119 #---------------------------------------------------------------------------
120
120
121 def find_package_data():
121 def find_package_data():
122 """
122 """
123 Find IPython's package_data.
123 Find IPython's package_data.
124 """
124 """
125 # This is not enough for these things to appear in an sdist.
125 # This is not enough for these things to appear in an sdist.
126 # We need to muck with the MANIFEST to get this to work
126 # We need to muck with the MANIFEST to get this to work
127 package_data = {'IPython.UserConfig' : ['*'] }
127 package_data = {'IPython.UserConfig' : ['*'] }
128 return package_data
128 return package_data
129
129
130
130
131 #---------------------------------------------------------------------------
131 #---------------------------------------------------------------------------
132 # Find data files
132 # Find data files
133 #---------------------------------------------------------------------------
133 #---------------------------------------------------------------------------
134
134
135 def find_data_files():
135 def find_data_files():
136 """
136 """
137 Find IPython's data_files.
137 Find IPython's data_files.
138 """
138 """
139
139
140 # I can't find how to make distutils create a nested dir. structure, so
140 # I can't find how to make distutils create a nested dir. structure, so
141 # in the meantime do it manually. Butt ugly.
141 # in the meantime do it manually. Butt ugly.
142 # Note that http://www.redbrick.dcu.ie/~noel/distutils.html, ex. 2/3, contain
142 # Note that http://www.redbrick.dcu.ie/~noel/distutils.html, ex. 2/3, contain
143 # information on how to do this more cleanly once python 2.4 can be assumed.
143 # information on how to do this more cleanly once python 2.4 can be assumed.
144 # Thanks to Noel for the tip.
144 # Thanks to Noel for the tip.
145 docdirbase = 'share/doc/ipython'
145 docdirbase = 'share/doc/ipython'
146 manpagebase = 'share/man/man1'
146 manpagebase = 'share/man/man1'
147
147
148 # We only need to exclude from this things NOT already excluded in the
148 # We only need to exclude from this things NOT already excluded in the
149 # MANIFEST.in file.
149 # MANIFEST.in file.
150 exclude = ('.sh','.1.gz')
150 exclude = ('.sh','.1.gz')
151 docfiles = filter(lambda f:file_doesnt_endwith(f,exclude),glob('doc/*'))
151 docfiles = filter(lambda f:file_doesnt_endwith(f,exclude),glob('doc/*'))
152 examfiles = filter(isfile, glob('doc/examples/*.py'))
152 examfiles = filter(isfile, glob('doc/examples/*.py'))
153 manfiles = filter(isfile, glob('doc/manual/*'))
153 manfiles = filter(isfile, glob('doc/manual/*'))
154 manstatic = filter(isfile, glob('doc/manual/_static/*'))
154 manstatic = filter(isfile, glob('doc/manual/_static/*'))
155 manpages = filter(isfile, glob('doc/*.1.gz'))
155 manpages = filter(isfile, glob('doc/*.1.gz'))
156 scriptfiles = filter(isfile, ['scripts/ipython','scripts/pycolor',
156 scriptfiles = filter(isfile, ['scripts/ipython','scripts/pycolor',
157 'scripts/irunner'])
157 'scripts/irunner'])
158 igridhelpfiles = filter(isfile, glob('IPython/Extensions/igrid_help.*'))
158 igridhelpfiles = filter(isfile, glob('IPython/Extensions/igrid_help.*'))
159
159
160 data_files = [('data', docdirbase, docfiles),
160 data_files = [('data', docdirbase, docfiles),
161 ('data', pjoin(docdirbase, 'examples'),examfiles),
161 ('data', pjoin(docdirbase, 'examples'),examfiles),
162 ('data', pjoin(docdirbase, 'manual'),manfiles),
162 ('data', pjoin(docdirbase, 'manual'),manfiles),
163 ('data', pjoin(docdirbase, 'manual/_static'),manstatic),
163 ('data', pjoin(docdirbase, 'manual/_static'),manstatic),
164 ('data', manpagebase, manpages),
164 ('data', manpagebase, manpages),
165 ('data',pjoin(docdirbase, 'extensions'),igridhelpfiles),
165 ('data',pjoin(docdirbase, 'extensions'),igridhelpfiles),
166 ]
166 ]
167 return data_files
167 return data_files
168
168
169 #---------------------------------------------------------------------------
169 #---------------------------------------------------------------------------
170 # Find scripts
170 # Find scripts
171 #---------------------------------------------------------------------------
171 #---------------------------------------------------------------------------
172
172
173 def find_scripts():
173 def find_scripts():
174 """
174 """
175 Find IPython's scripts.
175 Find IPython's scripts.
176 """
176 """
177 scripts = []
177 scripts = []
178 scripts.append('ipython1/kernel/scripts/ipengine')
178 scripts.append('ipython/kernel/scripts/ipengine')
179 scripts.append('ipython1/kernel/scripts/ipcontroller')
179 scripts.append('ipython/kernel/scripts/ipcontroller')
180 scripts.append('ipython1/kernel/scripts/ipcluster')
180 scripts.append('ipython/kernel/scripts/ipcluster')
181 scripts.append('scripts/ipython')
181 scripts.append('scripts/ipython')
182 scripts.append('scripts/pycolor')
182 scripts.append('scripts/pycolor')
183 scripts.append('scripts/irunner')
183 scripts.append('scripts/irunner')
184
184
185 # Script to be run by the windows binary installer after the default setup
185 # Script to be run by the windows binary installer after the default setup
186 # routine, to add shortcuts and similar windows-only things. Windows
186 # routine, to add shortcuts and similar windows-only things. Windows
187 # post-install scripts MUST reside in the scripts/ dir, otherwise distutils
187 # post-install scripts MUST reside in the scripts/ dir, otherwise distutils
188 # doesn't find them.
188 # doesn't find them.
189 if 'bdist_wininst' in sys.argv:
189 if 'bdist_wininst' in sys.argv:
190 if len(sys.argv) > 2 and ('sdist' in sys.argv or 'bdist_rpm' in sys.argv):
190 if len(sys.argv) > 2 and ('sdist' in sys.argv or 'bdist_rpm' in sys.argv):
191 print >> sys.stderr,"ERROR: bdist_wininst must be run alone. Exiting."
191 print >> sys.stderr,"ERROR: bdist_wininst must be run alone. Exiting."
192 sys.exit(1)
192 sys.exit(1)
193 scripts.append('scripts/ipython_win_post_install.py')
193 scripts.append('scripts/ipython_win_post_install.py')
194
194
195 return scripts
195 return scripts
196
196
197 #---------------------------------------------------------------------------
197 #---------------------------------------------------------------------------
198 # Find scripts
198 # Find scripts
199 #---------------------------------------------------------------------------
199 #---------------------------------------------------------------------------
200
200
201 def check_for_dependencies():
201 def check_for_dependencies():
202 """Check for IPython's dependencies.
202 """Check for IPython's dependencies.
203
203
204 This function should NOT be called if running under setuptools!
204 This function should NOT be called if running under setuptools!
205 """
205 """
206 from setupext.setupext import (
206 from setupext.setupext import (
207 print_line, print_raw, print_status, print_message,
207 print_line, print_raw, print_status, print_message,
208 check_for_zopeinterface, check_for_twisted,
208 check_for_zopeinterface, check_for_twisted,
209 check_for_foolscap, check_for_pyopenssl,
209 check_for_foolscap, check_for_pyopenssl,
210 check_for_sphinx, check_for_pygments,
210 check_for_sphinx, check_for_pygments,
211 check_for_nose, check_for_pexpect
211 check_for_nose, check_for_pexpect
212 )
212 )
213 print_line()
213 print_line()
214 print_raw("BUILDING IPYTHON")
214 print_raw("BUILDING IPYTHON")
215 print_status('python', sys.version)
215 print_status('python', sys.version)
216 print_status('platform', sys.platform)
216 print_status('platform', sys.platform)
217 if sys.platform == 'win32':
217 if sys.platform == 'win32':
218 print_status('Windows version', sys.getwindowsversion())
218 print_status('Windows version', sys.getwindowsversion())
219
219
220 print_raw("")
220 print_raw("")
221 print_raw("OPTIONAL DEPENDENCIES")
221 print_raw("OPTIONAL DEPENDENCIES")
222
222
223 check_for_zopeinterface()
223 check_for_zopeinterface()
224 check_for_twisted()
224 check_for_twisted()
225 check_for_foolscap()
225 check_for_foolscap()
226 check_for_pyopenssl()
226 check_for_pyopenssl()
227 check_for_sphinx()
227 check_for_sphinx()
228 check_for_pygments()
228 check_for_pygments()
229 check_for_nose()
229 check_for_nose()
230 check_for_pexpect() No newline at end of file
230 check_for_pexpect()
@@ -1,177 +1,178 b''
1 # encoding: utf-8
1 # encoding: utf-8
2
2
3 __docformat__ = "restructuredtext en"
3 __docformat__ = "restructuredtext en"
4
4
5 #-------------------------------------------------------------------------------
5 #-------------------------------------------------------------------------------
6 # Copyright (C) 2008 The IPython Development Team
6 # Copyright (C) 2008 The IPython Development Team
7 #
7 #
8 # Distributed under the terms of the BSD License. The full license is in
8 # Distributed under the terms of the BSD License. The full license is in
9 # the file COPYING, distributed as part of this software.
9 # the file COPYING, distributed as part of this software.
10 #-------------------------------------------------------------------------------
10 #-------------------------------------------------------------------------------
11
11
12 #-------------------------------------------------------------------------------
12 #-------------------------------------------------------------------------------
13 # Imports
13 # Imports
14 #-------------------------------------------------------------------------------
14 #-------------------------------------------------------------------------------
15
15
16 import sys, os
16 import sys, os
17 from textwrap import fill
17 from textwrap import fill
18
18
19 display_status=True
19 display_status=True
20
20
21 if display_status:
21 if display_status:
22 def print_line(char='='):
22 def print_line(char='='):
23 print char * 76
23 print char * 76
24
24
25 def print_status(package, status):
25 def print_status(package, status):
26 initial_indent = "%22s: " % package
26 initial_indent = "%22s: " % package
27 indent = ' ' * 24
27 indent = ' ' * 24
28 print fill(str(status), width=76,
28 print fill(str(status), width=76,
29 initial_indent=initial_indent,
29 initial_indent=initial_indent,
30 subsequent_indent=indent)
30 subsequent_indent=indent)
31
31
32 def print_message(message):
32 def print_message(message):
33 indent = ' ' * 24 + "* "
33 indent = ' ' * 24 + "* "
34 print fill(str(message), width=76,
34 print fill(str(message), width=76,
35 initial_indent=indent,
35 initial_indent=indent,
36 subsequent_indent=indent)
36 subsequent_indent=indent)
37
37
38 def print_raw(section):
38 def print_raw(section):
39 print section
39 print section
40 else:
40 else:
41 def print_line(*args, **kwargs):
41 def print_line(*args, **kwargs):
42 pass
42 pass
43 print_status = print_message = print_raw = print_line
43 print_status = print_message = print_raw = print_line
44
44
45 #-------------------------------------------------------------------------------
45 #-------------------------------------------------------------------------------
46 # Tests for specific packages
46 # Tests for specific packages
47 #-------------------------------------------------------------------------------
47 #-------------------------------------------------------------------------------
48
48
49 def check_for_ipython():
49 def check_for_ipython():
50 try:
50 try:
51 import IPython
51 import IPython
52 except ImportError:
52 except ImportError:
53 print_status("IPython", "Not found")
53 print_status("IPython", "Not found")
54 return False
54 return False
55 else:
55 else:
56 print_status("IPython", IPython.__version__)
56 print_status("IPython", IPython.__version__)
57 return True
57 return True
58
58
59 def check_for_zopeinterface():
59 def check_for_zopeinterface():
60 try:
60 try:
61 import zope.interface
61 import zope.interface
62 except ImportError:
62 except ImportError:
63 print_status("zope.Interface", "Not found (required for parallel computing capabilities)")
63 print_status("zope.Interface", "Not found (required for parallel computing capabilities)")
64 return False
64 return False
65 else:
65 else:
66 print_status("Zope.Interface","yes")
66 print_status("Zope.Interface","yes")
67 return True
67 return True
68
68
69 def check_for_twisted():
69 def check_for_twisted():
70 try:
70 try:
71 import twisted
71 import twisted
72 except ImportError:
72 except ImportError:
73 print_status("Twisted", "Not found (required for parallel computing capabilities)")
73 print_status("Twisted", "Not found (required for parallel computing capabilities)")
74 return False
74 return False
75 else:
75 else:
76 major = twisted.version.major
76 major = twisted.version.major
77 minor = twisted.version.minor
77 minor = twisted.version.minor
78 micro = twisted.version.micro
78 micro = twisted.version.micro
79 print_status("Twisted", twisted.version.short())
79 if not ((major==2 and minor>=5 and micro>=0) or \
80 if not ((major==2 and minor>=5 and micro>=0) or \
80 major>=8):
81 major>=8):
81 print_message("WARNING: IPython requires Twisted 2.5.0 or greater, you have version %s"%twisted.version.short())
82 print_message("WARNING: IPython requires Twisted 2.5.0 or greater, you have version %s"%twisted.version.short())
83 print_message("Twisted is required for parallel computing capabilities")
82 return False
84 return False
83 else:
85 else:
84 print_status("Twisted", twisted.version.short())
85 return True
86 return True
86
87
87 def check_for_foolscap():
88 def check_for_foolscap():
88 try:
89 try:
89 import foolscap
90 import foolscap
90 except ImportError:
91 except ImportError:
91 print_status('Foolscap', "Not found (required for parallel computing capabilities)")
92 print_status('Foolscap', "Not found (required for parallel computing capabilities)")
92 return False
93 return False
93 else:
94 else:
94 print_status('Foolscap', foolscap.__version__)
95 print_status('Foolscap', foolscap.__version__)
95 return True
96 return True
96
97
97 def check_for_pyopenssl():
98 def check_for_pyopenssl():
98 try:
99 try:
99 import OpenSSL
100 import OpenSSL
100 except ImportError:
101 except ImportError:
101 print_status('OpenSSL', "Not found (required if you want security in the parallel computing capabilities)")
102 print_status('OpenSSL', "Not found (required if you want security in the parallel computing capabilities)")
102 return False
103 return False
103 else:
104 else:
104 print_status('OpenSSL', OpenSSL.__version__)
105 print_status('OpenSSL', OpenSSL.__version__)
105 return True
106 return True
106
107
107 def check_for_sphinx():
108 def check_for_sphinx():
108 try:
109 try:
109 import sphinx
110 import sphinx
110 except ImportError:
111 except ImportError:
111 print_status('sphinx', "Not found (required for building the IPtyhon documentation)")
112 print_status('sphinx', "Not found (required for building documentation)")
112 return False
113 return False
113 else:
114 else:
114 print_status('sphinx', sphinx.__version__)
115 print_status('sphinx', sphinx.__version__)
115 return True
116 return True
116
117
117 def check_for_pygments():
118 def check_for_pygments():
118 try:
119 try:
119 import pygments
120 import pygments
120 except ImportError:
121 except ImportError:
121 print_status('pygments', "Not found (required for syntax highlighting of code in the IPtyhon documentation)")
122 print_status('pygments', "Not found (required for syntax highlighting documentation)")
122 return False
123 return False
123 else:
124 else:
124 print_status('pygments', pygments.__version__)
125 print_status('pygments', pygments.__version__)
125 return True
126 return True
126
127
127 def check_for_nose():
128 def check_for_nose():
128 try:
129 try:
129 import nose
130 import nose
130 except ImportError:
131 except ImportError:
131 print_status('nose', "Not found (required for running the IPython test suite)")
132 print_status('nose', "Not found (required for running the test suite)")
132 return False
133 return False
133 else:
134 else:
134 print_status('nose', nose.__version__)
135 print_status('nose', nose.__version__)
135 return True
136 return True
136
137
137 def check_for_pexpect():
138 def check_for_pexpect():
138 try:
139 try:
139 import pexpect
140 import pexpect
140 except ImportError:
141 except ImportError:
141 print_status("pexpect", "no (required for running standalone doctests)")
142 print_status("pexpect", "no (required for running standalone doctests)")
142 return False
143 return False
143 else:
144 else:
144 print_status("pexpect", pexpect.__version__)
145 print_status("pexpect", pexpect.__version__)
145 return True
146 return True
146
147
147 def check_for_httplib2():
148 def check_for_httplib2():
148 try:
149 try:
149 import httplib2
150 import httplib2
150 except ImportError:
151 except ImportError:
151 print_status("httplib2", "no (required for blocking http clients)")
152 print_status("httplib2", "no (required for blocking http clients)")
152 return False
153 return False
153 else:
154 else:
154 print_status("httplib2","yes")
155 print_status("httplib2","yes")
155 return True
156 return True
156
157
157 def check_for_sqlalchemy():
158 def check_for_sqlalchemy():
158 try:
159 try:
159 import sqlalchemy
160 import sqlalchemy
160 except ImportError:
161 except ImportError:
161 print_status("sqlalchemy", "no (required for the ipython1 notebook)")
162 print_status("sqlalchemy", "no (required for the ipython1 notebook)")
162 return False
163 return False
163 else:
164 else:
164 print_status("sqlalchemy","yes")
165 print_status("sqlalchemy","yes")
165 return True
166 return True
166
167
167 def check_for_simplejson():
168 def check_for_simplejson():
168 try:
169 try:
169 import simplejson
170 import simplejson
170 except ImportError:
171 except ImportError:
171 print_status("simplejson", "no (required for the ipython1 notebook)")
172 print_status("simplejson", "no (required for the ipython1 notebook)")
172 return False
173 return False
173 else:
174 else:
174 print_status("simplejson","yes")
175 print_status("simplejson","yes")
175 return True
176 return True
176
177
177 No newline at end of file
178
General Comments 0
You need to be logged in to leave comments. Login now