diff options
author | Steven Knight <knight@baldmt.com> | 2010-06-15 00:03:40 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2010-06-15 00:03:40 (GMT) |
commit | 155243b5bf995fb51c668dae69d606130bd05e1f (patch) | |
tree | 8566ba966c91aac72a1184859f4c3a631ddf079b /bin | |
parent | f621d6697cab25abc05b23f3fd443b805b1ee76f (diff) | |
download | SCons-155243b5bf995fb51c668dae69d606130bd05e1f.zip SCons-155243b5bf995fb51c668dae69d606130bd05e1f.tar.gz SCons-155243b5bf995fb51c668dae69d606130bd05e1f.tar.bz2 |
Update install_scons.py to work on Windows.
Diffstat (limited to 'bin')
-rw-r--r-- | bin/install_scons.py | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/bin/install_scons.py b/bin/install_scons.py index b5e0af8..93754f3 100644 --- a/bin/install_scons.py +++ b/bin/install_scons.py @@ -22,6 +22,8 @@ import getopt import os import shutil import sys +import tarfile +import urllib from Command import CommandRunner, Usage @@ -97,8 +99,12 @@ def main(argv=None): all = False downloads_dir = 'Downloads' downloads_url = 'http://downloads.sourceforge.net/scons' - sudo = 'sudo' - prefix = '/usr/local' + if sys.platform == 'win32': + sudo = '' + prefix = sys.prefix + else: + sudo = 'sudo' + prefix = '/usr/local' python = sys.executable short_options = 'ad:hnp:q' @@ -153,16 +159,19 @@ Usage: install_scons.py [-ahnq] [-d DIR] [-p PREFIX] [VERSION ...] for version in args: scons = 'scons-' + version tar_gz = os.path.join(downloads_dir, scons + '.tar.gz') - tar_gz_url = os.path.join(downloads_url, scons + '.tar.gz') + tar_gz_url = "%s/%s.tar.gz" % (downloads_url, scons) cmd.subst_dictionary(locals()) if not os.path.exists(tar_gz): if not os.path.exists(downloads_dir): cmd.run('mkdir %(downloads_dir)s') - cmd.run('wget -O %(tar_gz)s %(tar_gz_url)s') + cmd.run((urllib.urlretrieve, tar_gz_url, tar_gz), + 'wget -O %(tar_gz)s %(tar_gz_url)s') - cmd.run('tar zxf %(tar_gz)s') + def extract(tar_gz): + tarfile.open(tar_gz, "r:gz").extractall() + cmd.run((extract, tar_gz), 'tar zxf %(tar_gz)s') cmd.run('cd %(scons)s') |