@@ -50,11 +50,15 @@ def fix_path(dep_path):
# Module to import was passed as an argument
current_module = str(sys.argv[1]).rstrip()
+
if debug == True:
log = open('temp/log_%s' % current_module.strip('.*'),'w')
log.write('Module %s generated the following dependencies:\n' % current_module)
try:
+ real_stdout = sys.stdout
+ sys.stdout = None
m = importlib.import_module(current_module)
+
# handle python packages which may not include all modules in the __init__
if hasattr(m, '__file__') and os.path.basename(m.__file__) == "__init__.py":
modulepath = os.path.dirname(m.__file__)
@@ -70,6 +74,8 @@ except ImportError as e:
if debug == True:
log.write('Module was not found\n')
pass
+finally:
+ sys.stdout = real_stdout
# Get current module dependencies, dif will contain a list of specific deps for this module
gen_module_deps3.py imports modules and prints to stdout the list of dependencies. Some modules, such as this.py, also print to stdout. This results in garbage dependencies, so hide stdout when importing to avoid this problem. Signed-off-by: Ross Burton <ross.burton@arm.com> --- meta/recipes-devtools/python/python3/get_module_deps3.py | 6 ++++++ 1 file changed, 6 insertions(+)