summaryrefslogtreecommitdiffstats
path: root/src/engine
diff options
context:
space:
mode:
authorWilliam Deegan <bill@baddogconsulting.com>2017-10-13 03:13:49 (GMT)
committerWilliam Deegan <bill@baddogconsulting.com>2017-10-13 03:13:49 (GMT)
commit874dba0c35cd8f6459ddbdfcdaf8be12307cd038 (patch)
tree2e88edebb251f8da3ce9f862916606e06f00af6f /src/engine
parent23e7e0cedcda42be0f430ff1efcfa20f983d9cc5 (diff)
downloadSCons-874dba0c35cd8f6459ddbdfcdaf8be12307cd038.zip
SCons-874dba0c35cd8f6459ddbdfcdaf8be12307cd038.tar.gz
SCons-874dba0c35cd8f6459ddbdfcdaf8be12307cd038.tar.bz2
Fix issue with Tool loading logic where sys.path was getting an addition site_scons/site_tools path prepended with every tool loaded when running with Python 3.5+.
Diffstat (limited to 'src/engine')
-rw-r--r--src/engine/SCons/Tool/__init__.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/engine/SCons/Tool/__init__.py b/src/engine/SCons/Tool/__init__.py
index 57090bb..a4e44a0 100644
--- a/src/engine/SCons/Tool/__init__.py
+++ b/src/engine/SCons/Tool/__init__.py
@@ -222,8 +222,10 @@ class Tool(object):
# Don't reload a tool we already loaded.
sys_modules_value = sys.modules.get(found_name,False)
+
+ found_module = None
if sys_modules_value and sys_modules_value.__file__ == spec.origin:
- return sys.modules[found_name]
+ found_module = sys.modules[found_name]
else:
# Not sure what to do in the case that there already
# exists sys.modules[self.name] but the source file is
@@ -235,7 +237,11 @@ class Tool(object):
# If we found it in SCons.Tool, then add it to the module
setattr(SCons.Tool, self.name, module)
- return module
+ found_module = module
+
+ if found_module is not None:
+ sys.path = oldpythonpath
+ return found_module
sys.path = oldpythonpath