1
1
#! /usr/bin/env python
3
"""Installation script for bzr.
5
'./setup.py install', or
6
'./setup.py --help' for more options
15
# META INFORMATION FOR SETUP
17
META_INFO = {'name': 'bzr',
18
'version': bzrlib.__version__,
19
'author': 'Canonical Ltd',
20
'author_email': 'bazaar@lists.canonical.com',
21
'url': 'http://www.bazaar-vcs.org/',
22
'description': 'Friendly distributed version control system',
23
'license': 'GNU GPL v2',
26
# The list of packages is automatically generated later. Add other things
27
# that are part of BZRLIB here.
30
PKG_DATA = {# install files from selftest suite
31
'package_data': {'bzrlib': ['doc/api/*.txt',
32
'tests/test_patches_data/*',
36
######################################################################
3
# This is an installation script for bzr. Run it with
4
# './setup.py install', or
5
# './setup.py --help' for more options
37
7
# Reinvocation stolen from bzr, we need python2.4 by virtue of bzr_man
38
8
# including bzrlib.help
41
13
version_info = sys.version_info
42
14
except AttributeError:
58
30
print >>sys.stderr, "bzr: error: cannot find a suitable python interpreter"
59
31
print >>sys.stderr, " (need %d.%d or later)" % NEED_VERS
61
if getattr(os, "unsetenv", None) is not None:
33
if hasattr(os, "unsetenv"):
62
34
os.unsetenv(REINVOKE)
65
def get_bzrlib_packages():
66
"""Recurse through the bzrlib directory, and extract the package names"""
69
base_path = os.path.dirname(os.path.abspath(bzrlib.__file__))
70
for root, dirs, files in os.walk(base_path):
71
if '__init__.py' in files:
72
assert root.startswith(base_path)
73
# Get just the path below bzrlib
74
package_path = root[len(base_path):]
75
# Remove leading and trailing slashes
76
package_path = package_path.strip('\\/')
78
package_name = 'bzrlib'
80
package_name = ('bzrlib.' +
81
package_path.replace('/', '.').replace('\\', '.'))
82
packages.append(package_name)
83
return sorted(packages)
86
BZRLIB['packages'] = get_bzrlib_packages()
89
37
from distutils.core import setup
90
38
from distutils.command.install_scripts import install_scripts
91
39
from distutils.command.build import build
142
76
import generate_docs
143
77
generate_docs.main(argv=["bzr", "man"])
146
79
########################
148
81
########################
150
command_classes = {'install_scripts': my_install_scripts,
154
from Pyrex.Distutils import build_ext
156
# try to build the extension from the prior generated source.
157
print ("Pyrex not available, while bzr will build, "
158
"you cannot modify the C extensions.")
159
from distutils.command.build_ext import build_ext
160
from distutils.extension import Extension
162
# Extension("bzrlib.modulename", ["bzrlib/foo.c"], libraries = []))
164
from distutils.extension import Extension
166
# Extension("bzrlib.modulename", ["bzrlib/foo.pyx"], libraries = []))
167
command_classes['build_ext'] = build_ext
169
if 'bdist_wininst' in sys.argv:
172
docs = glob.glob('doc/*.htm') + ['doc/default.css']
173
dev_docs = glob.glob('doc/developers/*.htm')
174
# python's distutils-based win32 installer
175
ARGS = {'scripts': ['bzr', 'tools/win32/bzr-win32-bdist-postinstall.py'],
176
'ext_modules': ext_modules,
178
'data_files': [('Doc/Bazaar', docs),
179
('Doc/Bazaar/developers', dev_docs),
181
# for building pyrex extensions
182
'cmdclass': {'build_ext': build_ext},
185
ARGS.update(META_INFO)
187
ARGS.update(PKG_DATA)
191
elif 'py2exe' in sys.argv:
195
# pick real bzr version
199
for i in bzrlib.version_info[:4]:
204
version_number.append(str(i))
205
version_str = '.'.join(version_number)
207
target = py2exe.build_exe.Target(script = "bzr",
209
icon_resources = [(0,'bzr.ico')],
210
name = META_INFO['name'],
211
version = version_str,
212
description = META_INFO['description'],
213
author = META_INFO['author'],
214
copyright = "(c) Canonical Ltd, 2005-2007",
215
company_name = "Canonical Ltd.",
216
comments = META_INFO['description'],
219
additional_packages = []
220
if sys.version.startswith('2.4'):
221
# adding elementtree package
222
additional_packages.append('elementtree')
223
elif sys.version.startswith('2.5'):
224
additional_packages.append('xml.etree')
227
warnings.warn('Unknown Python version.\n'
228
'Please check setup.py script for compatibility.')
229
# email package from std python library use lazy import,
230
# so we need to explicitly add all package
231
additional_packages.append('email')
233
options_list = {"py2exe": {"packages": BZRLIB['packages'] +
235
"excludes": ["Tkinter", "medusa", "tools"],
236
"dist_dir": "win32_bzr.exe",
239
setup(options=options_list,
241
'tools/win32/bzr_postinstall.py',
243
zipfile='lib/library.zip')
247
ARGS = {'scripts': ['bzr'],
248
'data_files': [('man/man1', ['bzr.1'])],
249
'cmdclass': command_classes,
250
'ext_modules': ext_modules,
253
ARGS.update(META_INFO)
255
ARGS.update(PKG_DATA)
85
author='Canonical Ltd',
86
author_email='bazaar-ng@lists.ubuntu.com',
87
url='http://bazaar-vcs.org/',
88
description='Friendly distributed version control system',
95
'bzrlib.plugins.launchpad',
97
'bzrlib.store.revision',
98
'bzrlib.store.versioned',
100
'bzrlib.tests.blackbox',
101
'bzrlib.tests.branch_implementations',
102
'bzrlib.tests.bzrdir_implementations',
103
'bzrlib.tests.interrepository_implementations',
104
'bzrlib.tests.interversionedfile_implementations',
105
'bzrlib.tests.repository_implementations',
106
'bzrlib.tests.revisionstore_implementations',
107
'bzrlib.tests.workingtree_implementations',
109
'bzrlib.transport.http',
112
'bzrlib.util.elementtree',
113
'bzrlib.util.effbot.org',
114
'bzrlib.util.configobj',
116
'bzrlib.bundle.serializer'
119
cmdclass={'install_scripts': my_install_scripts, 'build': bzr_build},
120
data_files=[('man/man1', ['bzr.1'])],
121
# todo: install the txt files from bzrlib.doc.api.