4
4
# './setup.py install', or
5
5
# './setup.py --help' for more options
7
# Reinvocation stolen from bzr, we need python2.4 by virtue of bzr_man
8
# including bzrlib.help
13
version_info = sys.version_info
14
except AttributeError:
15
version_info = 1, 5 # 1.5 or older
17
REINVOKE = "__BZR_REINVOKE"
19
KNOWN_PYTHONS = ('python2.4',)
21
if version_info < NEED_VERS:
22
if not os.environ.has_key(REINVOKE):
23
# mutating os.environ doesn't work in old Pythons
24
os.putenv(REINVOKE, "1")
25
for python in KNOWN_PYTHONS:
27
os.execvp(python, [python] + sys.argv)
30
print >>sys.stderr, "bzr: error: cannot find a suitable python interpreter"
31
print >>sys.stderr, " (need %d.%d or later)" % NEED_VERS
33
if hasattr(os, "unsetenv"):
7
37
from distutils.core import setup
9
# more sophisticated setup script, based on pychecker setup.py
11
from distutils.command.build_scripts import build_scripts
38
from distutils.command.install_scripts import install_scripts
39
from distutils.command.build import build
14
41
###############################
15
42
# Overridden distutils actions
16
43
###############################
18
class my_build_scripts(build_scripts):
19
"""Customized build_scripts distutils action.
45
class my_install_scripts(install_scripts):
46
""" Customized install_scripts distutils action.
21
47
Create bzr.bat for win32.
53
install_scripts.run(self) # standard action
25
55
if sys.platform == "win32":
26
bat_path = os.path.join(self.build_dir, "bzr.bat")
27
self.scripts.append(bat_path)
28
self.mkpath(self.build_dir)
29
scripts_dir = self.distribution.get_command_obj("install").\
31
self.execute(func=self._create_bat,
32
args=[bat_path, scripts_dir],
33
msg="Create %s" % bat_path)
34
build_scripts.run(self) # invoke "standard" action
36
def _create_bat(self, bat_path, scripts_dir):
37
""" Creates the batch file for bzr on win32.
40
script_path = os.path.join(scripts_dir, "bzr")
41
bat_str = "@%s %s %%*\n" % (sys.executable, script_path)
42
file(bat_path, "w").write(bat_str)
45
print "ERROR: Unable to create %s: %s" % (bat_path, e)
57
scripts_dir = self.install_dir
58
script_path = os.path.join(scripts_dir, "bzr")
59
batch_str = "@%s %s %%*\n" % (sys.executable, script_path)
60
batch_path = script_path + ".bat"
61
f = file(batch_path, "w")
64
print "Created:", batch_path
66
print "ERROR: Unable to create %s: %s" % (batch_path, e)
69
class bzr_build(build):
70
"""Customized build distutils action.
77
generate_docs.main(argv=["bzr", "man"])
49
79
########################
51
81
########################
55
85
author='Martin Pool',
56
86
author_email='mbp@sourcefrog.net',
57
87
url='http://www.bazaar-ng.org/',
58
88
description='Friendly distributed version control system',
59
89
license='GNU GPL v2',
60
90
packages=['bzrlib',
96
'bzrlib.store.revision',
97
'bzrlib.store.versioned',
99
'bzrlib.tests.blackbox',
100
'bzrlib.tests.branch_implementations',
101
'bzrlib.tests.bzrdir_implementations',
102
'bzrlib.tests.interrepository_implementations',
103
'bzrlib.tests.interversionedfile_implementations',
104
'bzrlib.tests.repository_implementations',
105
'bzrlib.tests.revisionstore_implementations',
106
'bzrlib.tests.workingtree_implementations',
108
'bzrlib.transport.http',
66
111
'bzrlib.util.elementtree',
67
112
'bzrlib.util.effbot.org',
113
'bzrlib.util.configobj',
116
cmdclass={'install_scripts': my_install_scripts, 'build': bzr_build},
117
data_files=[('man/man1', ['bzr.1'])],
118
# todo: install the txt files from bzrlib.doc.api.