5
5
# './setup.py --help' for more options
7
7
from distutils.core import setup
9
# more sophisticated setup script, based on pychecker setup.py
11
from distutils.command.build_scripts import build_scripts
8
from distutils.command.install_scripts import install_scripts
14
11
###############################
15
12
# Overridden distutils actions
16
13
###############################
18
class my_build_scripts(build_scripts):
19
"""Customized build_scripts distutils action.
15
class my_install_scripts(install_scripts):
16
""" Customized install_scripts distutils action.
21
17
Create bzr.bat for win32.
23
install_scripts.run(self) # standard action
25
25
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)
27
scripts_dir = self.install_dir
28
script_path = os.path.join(scripts_dir, "bzr")
29
batch_str = "@%s %s %%*\n" % (sys.executable, script_path)
30
batch_path = script_path + ".bat"
31
f = file(batch_path, "w")
34
print "Created:", batch_path
36
print "ERROR: Unable to create %s: %s" % (batch_path, e)
49
39
########################