Source

SCons / bin / scons-test.py

Diff from to

File bin/scons-test.py

 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:
 
 # 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