import getopt
import os
+import shlex
import sys
class Usage(Exception):
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
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:
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:
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')):
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')
'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):
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:
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'):
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')