diff options
author | Luca Falavigna <dktrkranz@debian.org> | 2010-06-15 14:28:22 +0000 |
---|---|---|
committer | Luca Falavigna <dktrkranz@debian.org> | 2010-06-15 14:28:22 +0000 |
commit | 738149c9bfb9965d013d01ef99f9bb1c2819e7e8 (patch) | |
tree | 0397d9bf3b12c903dc73419585df231397ff343c /bin/scons-test.py | |
parent | e7885e3af440eaef38a9301fd92a105afc8ddebb (diff) |
Imported Upstream version 2.0.0upstream/2.0.0
Diffstat (limited to 'bin/scons-test.py')
-rw-r--r-- | bin/scons-test.py | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/bin/scons-test.py b/bin/scons-test.py index aa03d72..2191532 100644 --- a/bin/scons-test.py +++ b/bin/scons-test.py @@ -19,13 +19,21 @@ import getopt import imp import os import os.path -import string import sys import tempfile import time -import urllib import zipfile +try: + # try Python 3.x style + from urllib.request import urlretrieve +except ImportError: + # nope, must be 2.x; this hack is equivalent + import imp + # protect import from fixer + urlretrieve = imp.load_module('urllib', + *imp.find_module('urllib')).urlretrieve + helpstr = """\ Usage: scons-test.py [-f zipfile] [-o outdir] [-v] [--xml] [runtest arguments] Options: @@ -70,7 +78,7 @@ if not os.path.exists(tempdir): # Fetch the input file if it happens to be across a network somewhere. # Ohmigod, does Python make this simple... -inputfile, headers = urllib.urlretrieve(inputfile) +inputfile, headers = urlretrieve(inputfile) # Unzip the header file in the output directory. We use our own code # (lifted from scons-unzip.py) to make the output subdirectory name @@ -83,14 +91,14 @@ if outdir is None: def outname(n, outdir=outdir): l = [] - while 1: + while True: n, tail = os.path.split(n) if not n: break l.append(tail) l.append(outdir) l.reverse() - return apply(os.path.join, l) + return os.path.join(*l) for name in zf.namelist(): dest = outname(name) @@ -135,7 +143,7 @@ fp.close() if not args: runtest_args = '-a' else: - runtest_args = string.join(args) + runtest_args = ' '.join(args) if format == '--xml': @@ -205,10 +213,7 @@ if format == '--xml': ] print " <environment>" - #keys = os.environ.keys() - keys = environ_keys - keys.sort() - for key in keys: + for key in sorted(environ_keys): value = os.environ.get(key) if value: print " <variable>" |