context: "fix" waf tool loading with python 3.3

This commit is contained in:
Jérôme Carretero 2013-08-14 11:20:01 -04:00
parent f3f9e9f99d
commit 5db6202ce1
1 changed files with 7 additions and 3 deletions

View File

@ -620,13 +620,17 @@ def load_tool(tool, tooldir=None):
sys.path.remove(d)
else:
for x in ('waflib.extras.%s', 'waflib.Tools.%s', 'waflib.%s', '%s'):
full = x % tool
try:
__import__(x % tool)
__import__(full)
break
except ImportError as e:
if not e.args[0].endswith(tool):
if e.args[0].endswith(tool):
x = None
elif e.args[0].endswith("'%s'" % full):
x = None
else:
raise
x = None
if x is None: # raise an exception
__import__(tool)
ret = sys.modules[x % tool]