17
17
META_INFO = {'name': 'bzr',
18
18
'version': bzrlib.__version__,
19
19
'author': 'Canonical Ltd',
20
'author_email': 'bazaar@lists.canonical.com',
20
'author_email': 'bazaar-ng@lists.ubuntu.com',
21
21
'url': 'http://www.bazaar-vcs.org/',
22
22
'description': 'Friendly distributed version control system',
23
23
'license': 'GNU GPL v2',
148
150
########################
150
command_classes = {'install_scripts': my_install_scripts,
152
from distutils.extension import Extension
155
from Pyrex.Distutils import build_ext
158
# try to build the extension from the prior generated source.
160
print ("The python package 'Pyrex' is not available."
161
" If the .c files are available,")
162
print ("they will be built,"
163
" but modifying the .pyx files will not rebuild them.")
165
from distutils.command.build_ext import build_ext
168
# Override the build_ext if we have Pyrex available
169
command_classes['build_ext'] = build_ext
170
unavailable_files = []
173
def add_pyrex_extension(module_name, **kwargs):
174
"""Add a pyrex module to build.
176
This will use Pyrex to auto-generate the .c file if it is available.
177
Otherwise it will fall back on the .c file. If the .c file is not
178
available, it will warn, and not add anything.
180
You can pass any extra options to Extension through kwargs. One example is
183
:param module_name: The python path to the module. This will be used to
184
determine the .pyx and .c files to use.
186
path = module_name.replace('.', '/')
187
pyrex_name = path + '.pyx'
190
ext_modules.append(Extension(module_name, [pyrex_name]))
192
if not os.path.isfile(c_name):
193
unavailable_files.append(c_name)
195
ext_modules.append(Extension(module_name, [c_name]))
198
add_pyrex_extension('bzrlib._dirstate_helpers_c')
199
add_pyrex_extension('bzrlib._knit_load_data_c')
202
if unavailable_files:
203
print 'C extension(s) not found:'
204
print ' %s' % ('\n '.join(unavailable_files),)
205
print 'The python versions will be used instead.'
209
152
if 'bdist_wininst' in sys.argv:
212
155
docs = glob.glob('doc/*.htm') + ['doc/default.css']
213
dev_docs = glob.glob('doc/developers/*.htm')
214
156
# python's distutils-based win32 installer
215
157
ARGS = {'scripts': ['bzr', 'tools/win32/bzr-win32-bdist-postinstall.py'],
216
'ext_modules': ext_modules,
218
'data_files': [('Doc/Bazaar', docs),
219
('Doc/Bazaar/developers', dev_docs),
221
# for building pyrex extensions
222
'cmdclass': {'build_ext': build_ext},
159
'data_files': [('Doc/Bazaar', docs)],
225
162
ARGS.update(META_INFO)
251
188
version = version_str,
252
189
description = META_INFO['description'],
253
190
author = META_INFO['author'],
254
copyright = "(c) Canonical Ltd, 2005-2007",
191
copyright = "(c) Canonical Ltd, 2005-2006",
255
192
company_name = "Canonical Ltd.",
256
193
comments = META_INFO['description'],
259
additional_packages = []
260
if sys.version.startswith('2.4'):
261
# adding elementtree package
262
additional_packages.append('elementtree')
263
elif sys.version.startswith('2.5'):
264
additional_packages.append('xml.etree')
267
warnings.warn('Unknown Python version.\n'
268
'Please check setup.py script for compatibility.')
269
# email package from std python library use lazy import,
270
# so we need to explicitly add all package
271
additional_packages.append('email')
273
195
options_list = {"py2exe": {"packages": BZRLIB['packages'] +
275
"excludes": ["Tkinter", "medusa", "tools"],
197
"excludes": ["Tkinter", "medusa"],
276
198
"dist_dir": "win32_bzr.exe",
287
209
ARGS = {'scripts': ['bzr'],
288
210
'data_files': [('man/man1', ['bzr.1'])],
289
'cmdclass': command_classes,
290
'ext_modules': ext_modules,
211
'cmdclass': {'build': bzr_build,
212
'install_scripts': my_install_scripts,
293
216
ARGS.update(META_INFO)