From e7a8264ee58e0c0f3b713b7b8c827f1c32ba5265 Mon Sep 17 00:00:00 2001 From: stevenknight Date: Thu, 19 Feb 2009 05:58:40 +0000 Subject: [PATCH] dd newer SCons versions to the list of all versions available for install. Use shlex.split(), not string.split(), to split command line arguments. Commonize interpreation of 'cd' and 'mkdir' commands. Fix usage messages. git-svn-id: http://scons.tigris.org/svn/scons/trunk@4010 fdb21ef1-2011-0410-befe-b5e4ea1792b1 --- bin/Command.py | 14 +++++++++++--- bin/install_python.py | 13 ++++++------- bin/install_scons.py | 18 +++++++++++------- 3 files changed, 28 insertions(+), 17 deletions(-) diff --git a/bin/Command.py b/bin/Command.py index b47e896a..efaa3569 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 fff834cd..ca1c8b77 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 71e64771..34bc799b 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') -- 2.26.2