##// END OF EJS Templates
Include testing plugin for installation.
Fernando Perez -
r1581:ef4f6638 merge
parent child Browse files
Show More
@@ -1,276 +1,277 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,
85 def add_package(packages,pname,config=False,tests=False,scripts=False,
86 others=None):
86 others=None):
87 """
87 """
88 Add a package to the list of packages, including certain subpackages.
88 Add a package to the list of packages, including certain subpackages.
89 """
89 """
90 packages.append('.'.join(['IPython',pname]))
90 packages.append('.'.join(['IPython',pname]))
91 if config:
91 if config:
92 packages.append('.'.join(['IPython',pname,'config']))
92 packages.append('.'.join(['IPython',pname,'config']))
93 if tests:
93 if tests:
94 packages.append('.'.join(['IPython',pname,'tests']))
94 packages.append('.'.join(['IPython',pname,'tests']))
95 if scripts:
95 if scripts:
96 packages.append('.'.join(['IPython',pname,'scripts']))
96 packages.append('.'.join(['IPython',pname,'scripts']))
97 if others is not None:
97 if others is not None:
98 for o in others:
98 for o in others:
99 packages.append('.'.join(['IPython',pname,o]))
99 packages.append('.'.join(['IPython',pname,o]))
100
100
101 def find_packages():
101 def find_packages():
102 """
102 """
103 Find all of IPython's packages.
103 Find all of IPython's packages.
104 """
104 """
105 packages = ['IPython']
105 packages = ['IPython']
106 add_package(packages, 'config', tests=True)
106 add_package(packages, 'config', tests=True)
107 add_package(packages , 'Extensions')
107 add_package(packages , 'Extensions')
108 add_package(packages, 'external')
108 add_package(packages, 'external')
109 add_package(packages, 'gui')
109 add_package(packages, 'gui')
110 add_package(packages, 'gui.wx')
110 add_package(packages, 'gui.wx')
111 add_package(packages, 'frontend', tests=True)
111 add_package(packages, 'frontend', tests=True)
112 add_package(packages, 'frontend._process')
112 add_package(packages, 'frontend._process')
113 add_package(packages, 'frontend.wx')
113 add_package(packages, 'frontend.wx')
114 add_package(packages, 'frontend.cocoa', tests=True)
114 add_package(packages, 'frontend.cocoa', tests=True)
115 add_package(packages, 'kernel', config=True, tests=True, scripts=True)
115 add_package(packages, 'kernel', config=True, tests=True, scripts=True)
116 add_package(packages, 'kernel.core', config=True, tests=True)
116 add_package(packages, 'kernel.core', config=True, tests=True)
117 add_package(packages, 'testing', tests=True)
117 add_package(packages, 'testing', tests=True)
118 add_package(packages, 'testing.plugin', tests=False)
118 add_package(packages, 'tools', tests=True)
119 add_package(packages, 'tools', tests=True)
119 add_package(packages, 'UserConfig')
120 add_package(packages, 'UserConfig')
120 return packages
121 return packages
121
122
122 #---------------------------------------------------------------------------
123 #---------------------------------------------------------------------------
123 # Find package data
124 # Find package data
124 #---------------------------------------------------------------------------
125 #---------------------------------------------------------------------------
125
126
126 def find_package_data():
127 def find_package_data():
127 """
128 """
128 Find IPython's package_data.
129 Find IPython's package_data.
129 """
130 """
130 # This is not enough for these things to appear in an sdist.
131 # This is not enough for these things to appear in an sdist.
131 # We need to muck with the MANIFEST to get this to work
132 # We need to muck with the MANIFEST to get this to work
132 package_data = {
133 package_data = {
133 'IPython.UserConfig' : ['*'],
134 'IPython.UserConfig' : ['*'],
134 'IPython.tools.tests' : ['*.txt'],
135 'IPython.tools.tests' : ['*.txt'],
135 'IPython.testing' : ['*.txt']
136 'IPython.testing' : ['*.txt']
136 }
137 }
137 return package_data
138 return package_data
138
139
139
140
140 #---------------------------------------------------------------------------
141 #---------------------------------------------------------------------------
141 # Find data files
142 # Find data files
142 #---------------------------------------------------------------------------
143 #---------------------------------------------------------------------------
143
144
144 def make_dir_struct(tag,base,out_base):
145 def make_dir_struct(tag,base,out_base):
145 """Make the directory structure of all files below a starting dir.
146 """Make the directory structure of all files below a starting dir.
146
147
147 This is just a convenience routine to help build a nested directory
148 This is just a convenience routine to help build a nested directory
148 hierarchy because distutils is too stupid to do this by itself.
149 hierarchy because distutils is too stupid to do this by itself.
149
150
150 XXX - this needs a proper docstring!
151 XXX - this needs a proper docstring!
151 """
152 """
152
153
153 # we'll use these a lot below
154 # we'll use these a lot below
154 lbase = len(base)
155 lbase = len(base)
155 pathsep = os.path.sep
156 pathsep = os.path.sep
156 lpathsep = len(pathsep)
157 lpathsep = len(pathsep)
157
158
158 out = []
159 out = []
159 for (dirpath,dirnames,filenames) in os.walk(base):
160 for (dirpath,dirnames,filenames) in os.walk(base):
160 # we need to strip out the dirpath from the base to map it to the
161 # we need to strip out the dirpath from the base to map it to the
161 # output (installation) path. This requires possibly stripping the
162 # output (installation) path. This requires possibly stripping the
162 # path separator, because otherwise pjoin will not work correctly
163 # path separator, because otherwise pjoin will not work correctly
163 # (pjoin('foo/','/bar') returns '/bar').
164 # (pjoin('foo/','/bar') returns '/bar').
164
165
165 dp_eff = dirpath[lbase:]
166 dp_eff = dirpath[lbase:]
166 if dp_eff.startswith(pathsep):
167 if dp_eff.startswith(pathsep):
167 dp_eff = dp_eff[lpathsep:]
168 dp_eff = dp_eff[lpathsep:]
168 # The output path must be anchored at the out_base marker
169 # The output path must be anchored at the out_base marker
169 out_path = pjoin(out_base,dp_eff)
170 out_path = pjoin(out_base,dp_eff)
170 # Now we can generate the final filenames. Since os.walk only produces
171 # Now we can generate the final filenames. Since os.walk only produces
171 # filenames, we must join back with the dirpath to get full valid file
172 # filenames, we must join back with the dirpath to get full valid file
172 # paths:
173 # paths:
173 pfiles = [pjoin(dirpath,f) for f in filenames]
174 pfiles = [pjoin(dirpath,f) for f in filenames]
174 # Finally, generate the entry we need, which is a triple of (tag,output
175 # Finally, generate the entry we need, which is a triple of (tag,output
175 # path, files) for use as a data_files parameter in install_data.
176 # path, files) for use as a data_files parameter in install_data.
176 out.append((tag,out_path,pfiles))
177 out.append((tag,out_path,pfiles))
177
178
178 return out
179 return out
179
180
180
181
181 def find_data_files():
182 def find_data_files():
182 """
183 """
183 Find IPython's data_files.
184 Find IPython's data_files.
184
185
185 Most of these are docs.
186 Most of these are docs.
186 """
187 """
187
188
188 docdirbase = 'share/doc/ipython'
189 docdirbase = 'share/doc/ipython'
189 manpagebase = 'share/man/man1'
190 manpagebase = 'share/man/man1'
190
191
191 # Simple file lists can be made by hand
192 # Simple file lists can be made by hand
192 manpages = filter(isfile, glob('docs/man/*.1.gz'))
193 manpages = filter(isfile, glob('docs/man/*.1.gz'))
193 igridhelpfiles = filter(isfile, glob('IPython/Extensions/igrid_help.*'))
194 igridhelpfiles = filter(isfile, glob('IPython/Extensions/igrid_help.*'))
194
195
195 # For nested structures, use the utility above
196 # For nested structures, use the utility above
196 example_files = make_dir_struct('data','docs/examples',
197 example_files = make_dir_struct('data','docs/examples',
197 pjoin(docdirbase,'examples'))
198 pjoin(docdirbase,'examples'))
198 manual_files = make_dir_struct('data','docs/dist',pjoin(docdirbase,'manual'))
199 manual_files = make_dir_struct('data','docs/dist',pjoin(docdirbase,'manual'))
199
200
200 # And assemble the entire output list
201 # And assemble the entire output list
201 data_files = [ ('data',manpagebase, manpages),
202 data_files = [ ('data',manpagebase, manpages),
202 ('data',pjoin(docdirbase,'extensions'),igridhelpfiles),
203 ('data',pjoin(docdirbase,'extensions'),igridhelpfiles),
203 ] + manual_files + example_files
204 ] + manual_files + example_files
204
205
205 ## import pprint # dbg
206 ## import pprint # dbg
206 ## print '*'*80
207 ## print '*'*80
207 ## print 'data files'
208 ## print 'data files'
208 ## pprint.pprint(data_files)
209 ## pprint.pprint(data_files)
209 ## print '*'*80
210 ## print '*'*80
210
211
211 return data_files
212 return data_files
212
213
213 #---------------------------------------------------------------------------
214 #---------------------------------------------------------------------------
214 # Find scripts
215 # Find scripts
215 #---------------------------------------------------------------------------
216 #---------------------------------------------------------------------------
216
217
217 def find_scripts():
218 def find_scripts():
218 """
219 """
219 Find IPython's scripts.
220 Find IPython's scripts.
220 """
221 """
221 scripts = ['IPython/kernel/scripts/ipengine',
222 scripts = ['IPython/kernel/scripts/ipengine',
222 'IPython/kernel/scripts/ipcontroller',
223 'IPython/kernel/scripts/ipcontroller',
223 'IPython/kernel/scripts/ipcluster',
224 'IPython/kernel/scripts/ipcluster',
224 'scripts/ipython',
225 'scripts/ipython',
225 'scripts/ipythonx',
226 'scripts/ipythonx',
226 'scripts/pycolor',
227 'scripts/pycolor',
227 'scripts/irunner',
228 'scripts/irunner',
228 'scripts/iptest',
229 'scripts/iptest',
229 ]
230 ]
230
231
231 # Script to be run by the windows binary installer after the default setup
232 # Script to be run by the windows binary installer after the default setup
232 # routine, to add shortcuts and similar windows-only things. Windows
233 # routine, to add shortcuts and similar windows-only things. Windows
233 # post-install scripts MUST reside in the scripts/ dir, otherwise distutils
234 # post-install scripts MUST reside in the scripts/ dir, otherwise distutils
234 # doesn't find them.
235 # doesn't find them.
235 if 'bdist_wininst' in sys.argv:
236 if 'bdist_wininst' in sys.argv:
236 if len(sys.argv) > 2 and ('sdist' in sys.argv or 'bdist_rpm' in sys.argv):
237 if len(sys.argv) > 2 and ('sdist' in sys.argv or 'bdist_rpm' in sys.argv):
237 print >> sys.stderr,"ERROR: bdist_wininst must be run alone. Exiting."
238 print >> sys.stderr,"ERROR: bdist_wininst must be run alone. Exiting."
238 sys.exit(1)
239 sys.exit(1)
239 scripts.append('scripts/ipython_win_post_install.py')
240 scripts.append('scripts/ipython_win_post_install.py')
240
241
241 return scripts
242 return scripts
242
243
243 #---------------------------------------------------------------------------
244 #---------------------------------------------------------------------------
244 # Verify all dependencies
245 # Verify all dependencies
245 #---------------------------------------------------------------------------
246 #---------------------------------------------------------------------------
246
247
247 def check_for_dependencies():
248 def check_for_dependencies():
248 """Check for IPython's dependencies.
249 """Check for IPython's dependencies.
249
250
250 This function should NOT be called if running under setuptools!
251 This function should NOT be called if running under setuptools!
251 """
252 """
252 from setupext.setupext import (
253 from setupext.setupext import (
253 print_line, print_raw, print_status, print_message,
254 print_line, print_raw, print_status, print_message,
254 check_for_zopeinterface, check_for_twisted,
255 check_for_zopeinterface, check_for_twisted,
255 check_for_foolscap, check_for_pyopenssl,
256 check_for_foolscap, check_for_pyopenssl,
256 check_for_sphinx, check_for_pygments,
257 check_for_sphinx, check_for_pygments,
257 check_for_nose, check_for_pexpect
258 check_for_nose, check_for_pexpect
258 )
259 )
259 print_line()
260 print_line()
260 print_raw("BUILDING IPYTHON")
261 print_raw("BUILDING IPYTHON")
261 print_status('python', sys.version)
262 print_status('python', sys.version)
262 print_status('platform', sys.platform)
263 print_status('platform', sys.platform)
263 if sys.platform == 'win32':
264 if sys.platform == 'win32':
264 print_status('Windows version', sys.getwindowsversion())
265 print_status('Windows version', sys.getwindowsversion())
265
266
266 print_raw("")
267 print_raw("")
267 print_raw("OPTIONAL DEPENDENCIES")
268 print_raw("OPTIONAL DEPENDENCIES")
268
269
269 check_for_zopeinterface()
270 check_for_zopeinterface()
270 check_for_twisted()
271 check_for_twisted()
271 check_for_foolscap()
272 check_for_foolscap()
272 check_for_pyopenssl()
273 check_for_pyopenssl()
273 check_for_sphinx()
274 check_for_sphinx()
274 check_for_pygments()
275 check_for_pygments()
275 check_for_nose()
276 check_for_nose()
276 check_for_pexpect()
277 check_for_pexpect()
General Comments 0
You need to be logged in to leave comments. Login now