summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Deegan <bill@baddogconsulting.com>2016-05-19 16:10:34 (GMT)
committerWilliam Deegan <bill@baddogconsulting.com>2016-05-19 16:10:34 (GMT)
commit6cb5d61fa6244c37b2aeb0255e47b9b749d3f4d1 (patch)
tree1d9cbd2465ca247062106e4da320f7f9f2110d67
parent01ab580ffdd90459f729d44efa6a3f0cc733fbf5 (diff)
downloadSCons-6cb5d61fa6244c37b2aeb0255e47b9b749d3f4d1.zip
SCons-6cb5d61fa6244c37b2aeb0255e47b9b749d3f4d1.tar.gz
SCons-6cb5d61fa6244c37b2aeb0255e47b9b749d3f4d1.tar.bz2
minor improvement to Tool loading code for py2/3 compat
-rw-r--r--src/engine/SCons/Tool/__init__.py29
1 files changed, 15 insertions, 14 deletions
diff --git a/src/engine/SCons/Tool/__init__.py b/src/engine/SCons/Tool/__init__.py
index 87ebb98..1590053 100644
--- a/src/engine/SCons/Tool/__init__.py
+++ b/src/engine/SCons/Tool/__init__.py
@@ -120,21 +120,22 @@ class Tool(object):
return importlib.import_module(self.name)
except ImportError as e:
# Then try modules in main distribution
- return importlib.import_module('SCons.Tool.'+self.name)
- except ImportError as e:
- if str(e) != "No module named %s" % self.name:
- raise SCons.Errors.EnvironmentError(e)
try:
- import zipimport
- except ImportError:
- pass
- else:
- for aPath in self.toolpath:
- try:
- importer = zipimport.zipimporter(aPath)
- return importer.load_module(self.name)
- except ImportError as e:
- pass
+ return importlib.import_module('SCons.Tool.'+self.name)
+ except ImportError as e:
+ if str(e) != "No module named %s" % self.name:
+ raise SCons.Errors.EnvironmentError(e)
+ try:
+ import zipimport
+ except ImportError:
+ pass
+ else:
+ for aPath in self.toolpath:
+ try:
+ importer = zipimport.zipimporter(aPath)
+ return importer.load_module(self.name)
+ except ImportError as e:
+ pass
finally:
sys.path = oldpythonpath