##// END OF EJS Templates
Add the subpackage to the setupbase.py
gvaroquaux -
Show More
@@ -1,232 +1,236 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(['IPython',pname]))
89 packages.append('.'.join(['IPython',pname]))
90 if config:
90 if config:
91 packages.append('.'.join(['IPython',pname,'config']))
91 packages.append('.'.join(['IPython',pname,'config']))
92 if tests:
92 if tests:
93 packages.append('.'.join(['IPython',pname,'tests']))
93 packages.append('.'.join(['IPython',pname,'tests']))
94 if scripts:
94 if scripts:
95 packages.append('.'.join(['IPython',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(['IPython',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, 'frontend')
111 add_package(packages, 'frontend._process')
112 add_package(packages, 'frontend.wx')
113 add_package(packages, 'frontend.cocoa')
110 add_package(packages, 'kernel', config=True, tests=True, scripts=True)
114 add_package(packages, 'kernel', config=True, tests=True, scripts=True)
111 add_package(packages, 'kernel.core', config=True, tests=True)
115 add_package(packages, 'kernel.core', config=True, tests=True)
112 add_package(packages, 'testing', tests=True)
116 add_package(packages, 'testing', tests=True)
113 add_package(packages, 'tools', tests=True)
117 add_package(packages, 'tools', tests=True)
114 add_package(packages, 'UserConfig')
118 add_package(packages, 'UserConfig')
115 return packages
119 return packages
116
120
117 #---------------------------------------------------------------------------
121 #---------------------------------------------------------------------------
118 # Find package data
122 # Find package data
119 #---------------------------------------------------------------------------
123 #---------------------------------------------------------------------------
120
124
121 def find_package_data():
125 def find_package_data():
122 """
126 """
123 Find IPython's package_data.
127 Find IPython's package_data.
124 """
128 """
125 # This is not enough for these things to appear in an sdist.
129 # 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
130 # We need to muck with the MANIFEST to get this to work
127 package_data = {
131 package_data = {
128 'IPython.UserConfig' : ['*'],
132 'IPython.UserConfig' : ['*'],
129 'IPython.tools.tests' : ['*.txt'],
133 'IPython.tools.tests' : ['*.txt'],
130 'IPython.testing' : ['*.txt']
134 'IPython.testing' : ['*.txt']
131 }
135 }
132 return package_data
136 return package_data
133
137
134
138
135 #---------------------------------------------------------------------------
139 #---------------------------------------------------------------------------
136 # Find data files
140 # Find data files
137 #---------------------------------------------------------------------------
141 #---------------------------------------------------------------------------
138
142
139 def find_data_files():
143 def find_data_files():
140 """
144 """
141 Find IPython's data_files.
145 Find IPython's data_files.
142 """
146 """
143
147
144 # I can't find how to make distutils create a nested dir. structure, so
148 # I can't find how to make distutils create a nested dir. structure, so
145 # in the meantime do it manually. Butt ugly.
149 # in the meantime do it manually. Butt ugly.
146 # Note that http://www.redbrick.dcu.ie/~noel/distutils.html, ex. 2/3, contain
150 # Note that http://www.redbrick.dcu.ie/~noel/distutils.html, ex. 2/3, contain
147 # information on how to do this more cleanly once python 2.4 can be assumed.
151 # information on how to do this more cleanly once python 2.4 can be assumed.
148 # Thanks to Noel for the tip.
152 # Thanks to Noel for the tip.
149 docdirbase = 'share/doc/ipython'
153 docdirbase = 'share/doc/ipython'
150 manpagebase = 'share/man/man1'
154 manpagebase = 'share/man/man1'
151
155
152 # We only need to exclude from this things NOT already excluded in the
156 # We only need to exclude from this things NOT already excluded in the
153 # MANIFEST.in file.
157 # MANIFEST.in file.
154 exclude = ('.sh','.1.gz')
158 exclude = ('.sh','.1.gz')
155 # We need to figure out how we want to package all of our rst docs?
159 # We need to figure out how we want to package all of our rst docs?
156 # docfiles = filter(lambda f:file_doesnt_endwith(f,exclude),glob('docs/*'))
160 # docfiles = filter(lambda f:file_doesnt_endwith(f,exclude),glob('docs/*'))
157 examfiles = filter(isfile, glob('docs/examples/core/*.py'))
161 examfiles = filter(isfile, glob('docs/examples/core/*.py'))
158 examfiles.append(filter(isfile, glob('docs/examples/kernel/*.py')))
162 examfiles.append(filter(isfile, glob('docs/examples/kernel/*.py')))
159 manpages = filter(isfile, glob('docs/man/*.1.gz'))
163 manpages = filter(isfile, glob('docs/man/*.1.gz'))
160 igridhelpfiles = filter(isfile, glob('IPython/Extensions/igrid_help.*'))
164 igridhelpfiles = filter(isfile, glob('IPython/Extensions/igrid_help.*'))
161
165
162 data_files = [#('data', docdirbase, docfiles),
166 data_files = [#('data', docdirbase, docfiles),
163 ('data', pjoin(docdirbase, 'examples'),examfiles),
167 ('data', pjoin(docdirbase, 'examples'),examfiles),
164 ('data', manpagebase, manpages),
168 ('data', manpagebase, manpages),
165 ('data',pjoin(docdirbase, 'extensions'),igridhelpfiles),
169 ('data',pjoin(docdirbase, 'extensions'),igridhelpfiles),
166 ]
170 ]
167 # import pprint
171 # import pprint
168 # pprint.pprint(data_files)
172 # pprint.pprint(data_files)
169 return []
173 return []
170
174
171 #---------------------------------------------------------------------------
175 #---------------------------------------------------------------------------
172 # Find scripts
176 # Find scripts
173 #---------------------------------------------------------------------------
177 #---------------------------------------------------------------------------
174
178
175 def find_scripts():
179 def find_scripts():
176 """
180 """
177 Find IPython's scripts.
181 Find IPython's scripts.
178 """
182 """
179 scripts = []
183 scripts = []
180 scripts.append('IPython/kernel/scripts/ipengine')
184 scripts.append('IPython/kernel/scripts/ipengine')
181 scripts.append('IPython/kernel/scripts/ipcontroller')
185 scripts.append('IPython/kernel/scripts/ipcontroller')
182 scripts.append('IPython/kernel/scripts/ipcluster')
186 scripts.append('IPython/kernel/scripts/ipcluster')
183 scripts.append('scripts/ipython')
187 scripts.append('scripts/ipython')
184 scripts.append('scripts/pycolor')
188 scripts.append('scripts/pycolor')
185 scripts.append('scripts/irunner')
189 scripts.append('scripts/irunner')
186
190
187 # Script to be run by the windows binary installer after the default setup
191 # Script to be run by the windows binary installer after the default setup
188 # routine, to add shortcuts and similar windows-only things. Windows
192 # routine, to add shortcuts and similar windows-only things. Windows
189 # post-install scripts MUST reside in the scripts/ dir, otherwise distutils
193 # post-install scripts MUST reside in the scripts/ dir, otherwise distutils
190 # doesn't find them.
194 # doesn't find them.
191 if 'bdist_wininst' in sys.argv:
195 if 'bdist_wininst' in sys.argv:
192 if len(sys.argv) > 2 and ('sdist' in sys.argv or 'bdist_rpm' in sys.argv):
196 if len(sys.argv) > 2 and ('sdist' in sys.argv or 'bdist_rpm' in sys.argv):
193 print >> sys.stderr,"ERROR: bdist_wininst must be run alone. Exiting."
197 print >> sys.stderr,"ERROR: bdist_wininst must be run alone. Exiting."
194 sys.exit(1)
198 sys.exit(1)
195 scripts.append('scripts/ipython_win_post_install.py')
199 scripts.append('scripts/ipython_win_post_install.py')
196
200
197 return scripts
201 return scripts
198
202
199 #---------------------------------------------------------------------------
203 #---------------------------------------------------------------------------
200 # Find scripts
204 # Find scripts
201 #---------------------------------------------------------------------------
205 #---------------------------------------------------------------------------
202
206
203 def check_for_dependencies():
207 def check_for_dependencies():
204 """Check for IPython's dependencies.
208 """Check for IPython's dependencies.
205
209
206 This function should NOT be called if running under setuptools!
210 This function should NOT be called if running under setuptools!
207 """
211 """
208 from setupext.setupext import (
212 from setupext.setupext import (
209 print_line, print_raw, print_status, print_message,
213 print_line, print_raw, print_status, print_message,
210 check_for_zopeinterface, check_for_twisted,
214 check_for_zopeinterface, check_for_twisted,
211 check_for_foolscap, check_for_pyopenssl,
215 check_for_foolscap, check_for_pyopenssl,
212 check_for_sphinx, check_for_pygments,
216 check_for_sphinx, check_for_pygments,
213 check_for_nose, check_for_pexpect
217 check_for_nose, check_for_pexpect
214 )
218 )
215 print_line()
219 print_line()
216 print_raw("BUILDING IPYTHON")
220 print_raw("BUILDING IPYTHON")
217 print_status('python', sys.version)
221 print_status('python', sys.version)
218 print_status('platform', sys.platform)
222 print_status('platform', sys.platform)
219 if sys.platform == 'win32':
223 if sys.platform == 'win32':
220 print_status('Windows version', sys.getwindowsversion())
224 print_status('Windows version', sys.getwindowsversion())
221
225
222 print_raw("")
226 print_raw("")
223 print_raw("OPTIONAL DEPENDENCIES")
227 print_raw("OPTIONAL DEPENDENCIES")
224
228
225 check_for_zopeinterface()
229 check_for_zopeinterface()
226 check_for_twisted()
230 check_for_twisted()
227 check_for_foolscap()
231 check_for_foolscap()
228 check_for_pyopenssl()
232 check_for_pyopenssl()
229 check_for_sphinx()
233 check_for_sphinx()
230 check_for_pygments()
234 check_for_pygments()
231 check_for_nose()
235 check_for_nose()
232 check_for_pexpect()
236 check_for_pexpect()
General Comments 0
You need to be logged in to leave comments. Login now