diff options
Diffstat (limited to 'bin')
-rw-r--r-- | bin/Command.py | 14 | ||||
-rw-r--r-- | bin/install_python.py | 13 | ||||
-rw-r--r-- | bin/install_scons.py | 18 |
3 files changed, 28 insertions, 17 deletions
diff --git a/bin/Command.py b/bin/Command.py index b47e896..efaa356 100644 --- a/bin/Command.py +++ b/bin/Command.py @@ -7,6 +7,7 @@ import getopt import os +import shlex import sys class Usage(Exception): @@ -58,12 +59,19 @@ class CommandRunner: pass def do_execute(self, command): + if type(command) == type(''): + command = self.subst(command) + cmdargs = shlex.split(command) + if cmdargs[0] == 'cd': + command = (os.chdir,) + tuple(cmdargs[1:]) + elif cmdargs[0] == 'mkdir': + command = (os.mkdir,) + tuple(cmdargs[1:]) if type(command) == type(()): func = command[0] args = command[1:] return func(*args) else: - return os.system(self.subst(command)) + return os.system(command) def do_not_execute(self, command): pass @@ -94,8 +102,8 @@ def main(argv=None): Usage: script-template.py [-hnq] -h, --help Print this help and exit - -n, --no-exec No execute, just print the command line - -q, --quiet Quiet, don't print the command line + -n, --no-exec No execute, just print command lines + -q, --quiet Quiet, don't print command lines """ try: diff --git a/bin/install_python.py b/bin/install_python.py index fff834c..ca1c8b7 100644 --- a/bin/install_python.py +++ b/bin/install_python.py @@ -39,14 +39,14 @@ def main(argv=None): long_options = ['all', 'help', 'no-exec', 'prefix=', 'quiet'] helpstr = """\ -sage: installs-scons.py [-ahnq] [-d DIR] [-p PREFIX] [VERSION ...] +Usage: install_python.py [-ahnq] [-d DIR] [-p PREFIX] [VERSION ...] -a, --all Install all SCons versions. -d DIR, --downloads=DIR Downloads directory. -h, --help Print this help and exit - -n, --no-exec No execute, just print the command line + -n, --no-exec No execute, just print command lines -p PREFIX, --prefix=PREFIX Installation prefix. - -q, --quiet Quiet, don't print the command line + -q, --quiet Quiet, don't print command lines """ try: @@ -103,13 +103,12 @@ sage: installs-scons.py [-ahnq] [-d DIR] [-p PREFIX] [VERSION ...] if not os.path.exists(tar_gz): if not os.path.exists(downloads_dir): - cmd.run((os.mkdir, downloads_dir), - 'mkdir %(downloads_dir)s') + cmd.run('mkdir %(downloads_dir)s') cmd.run('wget -O %(tar_gz)s %(tar_gz_url)s') cmd.run('tar zxf %(tar_gz)s') - cmd.run((os.chdir, python), 'cd %(python)s') + cmd.run('cd %(python)s') if (version.startswith('1.6') or version.startswith('2.0')): @@ -128,7 +127,7 @@ sage: installs-scons.py [-ahnq] [-d DIR] [-p PREFIX] [VERSION ...] cmd.run('%(sudo)s rm -f %(prefix)s/bin/{idle,pydoc,python,python-config,smtpd.py}') - cmd.run((os.chdir, '..'), 'cd ..') + cmd.run('cd ..') cmd.run((shutil.rmtree, python), 'rm -rf %(python)s') diff --git a/bin/install_scons.py b/bin/install_scons.py index 71e6477..34bc799 100644 --- a/bin/install_scons.py +++ b/bin/install_scons.py @@ -73,6 +73,11 @@ all_versions = [ '1.0.1.d20080915', '1.0.1.d20081001', '1.1.0', + '1.1.0.d20081104', + '1.1.0.d20081125', + '1.1.0.d20081207', + '1.2.0', + '1.2.0.d20090113', ] def main(argv=None): @@ -90,14 +95,14 @@ def main(argv=None): long_options = ['all', 'help', 'no-exec', 'prefix=', 'quiet'] helpstr = """\ -Usage: install-scons.py [-ahnq] [-d DIR] [-p PREFIX] [VERSION ...] +Usage: install_scons.py [-ahnq] [-d DIR] [-p PREFIX] [VERSION ...] -a, --all Install all SCons versions. -d DIR, --downloads=DIR Downloads directory. -h, --help Print this help and exit - -n, --no-exec No execute, just print the command line + -n, --no-exec No execute, just print command lines -p PREFIX, --prefix=PREFIX Installation prefix. - -q, --quiet Quiet, don't print the command line + -q, --quiet Quiet, don't print command lines """ try: @@ -144,13 +149,12 @@ Usage: install-scons.py [-ahnq] [-d DIR] [-p PREFIX] [VERSION ...] if not os.path.exists(tar_gz): if not os.path.exists(downloads_dir): - cmd.run((os.mkdir, downloads_dir), - 'mkdir %(downloads_dir)s') + cmd.run('mkdir %(downloads_dir)s') cmd.run('wget -O %(tar_gz)s %(tar_gz_url)s') cmd.run('tar zxf %(tar_gz)s') - cmd.run((os.chdir, scons), 'cd %(scons)s') + cmd.run('cd %(scons)s') if version in ('0.01', '0.02', '0.03', '0.04', '0.05', '0.06', '0.07', '0.08', '0.09', '0.10'): @@ -197,7 +201,7 @@ Usage: install-scons.py [-ahnq] [-d DIR] [-p PREFIX] [VERSION ...] cmd.run('%(python)s setup.py build') cmd.run('%(sudo)s %(python)s setup.py install --prefix=%(prefix)s --no-scons-script') - cmd.run((os.chdir, '..'), 'cd ..') + cmd.run('cd ..') cmd.run((shutil.rmtree, scons), 'rm -rf %(scons)s') |