2
0
mirror of https://gitlab.com/ita1024/waf.git synced 2025-01-10 10:25:23 +01:00

Revert "fix load_tool error messages and cover all occourences"

This reverts commit 0557256db454a6ab98e4b909be8fd5db9bbb49c2.

The solution is not viable for API change, let's remove this.
This commit is contained in:
fedepell 2017-11-09 07:15:44 +01:00 committed by ita1024
parent 5d3576af45
commit eb6c205ad1
3 changed files with 6 additions and 8 deletions

View File

@ -378,7 +378,7 @@ class BuildContext(Context.Context):
self.setup(i, tooldir)
return
module = Context.load_tool(tool, tooldir, self)
module = Context.load_tool(tool, tooldir)
if hasattr(module, "setup"):
module.setup(self)

View File

@ -254,6 +254,8 @@ class ConfigurationContext(Context.Context):
module = None
try:
module = Context.load_tool(tool, tooldir, ctx=self, with_sys_path=with_sys_path)
except ImportError as e:
self.fatal('Could not load the Waf tool %r from %r\n%s' % (tool, sys.path, e))
except Exception as e:
self.to_log('imp %r (%r & %r)' % (tool, tooldir, funs))
self.to_log(traceback.format_exc())

View File

@ -188,7 +188,7 @@ class Context(ctx):
with_sys_path = kw.get('with_sys_path', True)
for t in tools:
module = load_tool(t, path, self, with_sys_path=with_sys_path)
module = load_tool(t, path, with_sys_path=with_sys_path)
fun = getattr(module, kw.get('name', self.fun), None)
if fun:
fun(self)
@ -624,7 +624,7 @@ class Context(ctx):
lst = self.root.find_node(waf_dir).find_node('waflib/extras').ant_glob(var)
for x in lst:
if not x.name in ban:
load_tool(x.name.replace('.py', ''), ctx=self)
load_tool(x.name.replace('.py', ''))
else:
from zipfile import PyZipFile
waflibs = PyZipFile(waf_dir)
@ -640,7 +640,7 @@ class Context(ctx):
doban = True
if not doban:
f = f.replace('.py', '')
load_tool(f, ctx=self)
load_tool(f)
cache_modules = {}
"""
@ -703,8 +703,6 @@ def load_tool(tool, tooldir=None, ctx=None, with_sys_path=True):
sys.path = tooldir + sys.path
try:
__import__(tool)
except ImportError as e:
ctx.fatal('Could not load the Waf tool %r from %r\n%s' % (tool, sys.path, e))
finally:
for d in tooldir:
sys.path.remove(d)
@ -723,8 +721,6 @@ def load_tool(tool, tooldir=None, ctx=None, with_sys_path=True):
x = None
else: # raise an exception
__import__(tool)
except ImportError as e:
ctx.fatal('Could not load the Waf tool %r from %r\n%s' % (tool, sys.path, e))
finally:
if not with_sys_path:
sys.path.remove(waf_dir)