summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2010-06-15 00:03:40 +0000
committerSteven Knight <knight@baldmt.com>2010-06-15 00:03:40 +0000
commit3a60477c43f3351a04afe0d57fcda5eaa4c51d40 (patch)
tree8566ba966c91aac72a1184859f4c3a631ddf079b /bin
parent321f19d12213300e76714b0561745e849d78fe5e (diff)
downloadscons-3a60477c43f3351a04afe0d57fcda5eaa4c51d40.tar.gz
Update install_scons.py to work on Windows.
Diffstat (limited to 'bin')
-rw-r--r--bin/install_scons.py19
1 files changed, 14 insertions, 5 deletions
diff --git a/bin/install_scons.py b/bin/install_scons.py
index b5e0af80..93754f32 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')