Skip to content

Commit 7f8ab8d

Browse files
committed
Avoid false positives in dependency checking
Check only stdout not stderr. The latter may contain lines like > WARNING: Found one or more non-allowed loaded (EasyBuild-generated) modules in current environment: > * GCCcore/10.3.0
1 parent 9a3eb24 commit 7f8ab8d

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

easybuild/scripts/findPythonDeps.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,13 @@ def can_run(cmd, argument):
4040
return False
4141

4242

43-
def run_cmd(arguments, action_desc, **kwargs):
43+
def run_cmd(arguments, action_desc, capture_stderr=True, **kwargs):
4444
"""Run the command and return the return code and output"""
4545
extra_args = kwargs or {}
4646
if sys.version_info[0] >= 3:
4747
extra_args['universal_newlines'] = True
48-
p = subprocess.Popen(arguments, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, **extra_args)
48+
stderr = subprocess.STDOUT if capture_stderr else subprocess.PIPE
49+
p = subprocess.Popen(arguments, stdout=subprocess.PIPE, stderr=stderr, **extra_args)
4950
out, _ = p.communicate()
5051
if p.returncode != 0:
5152
raise RuntimeError('Failed to %s: %s' % (action_desc, out))
@@ -157,8 +158,13 @@ def print_deps(package, verbose):
157158
sys.exit(1)
158159
if args.verbose:
159160
print('Checking with EasyBuild for missing dependencies')
160-
missing_dep_out = run_cmd(['eb', args.ec, '--missing'], action_desc='Get missing dependencies')
161-
missing_deps = [dep for dep in missing_dep_out.split('\n') if dep.startswith('*') and '(%s)' % args.ec not in dep]
161+
missing_dep_out = run_cmd(['eb', args.ec, '--missing'],
162+
capture_stderr=False,
163+
action_desc='Get missing dependencies'
164+
)
165+
missing_deps = [dep for dep in missing_dep_out.split('\n')
166+
if dep.startswith('*') and '(%s)' % args.ec not in dep
167+
]
162168
if missing_deps:
163169
print('You need to install all modules on which %s depends first!' % args.ec)
164170
print('\n\t'.join(['Missing:'] + missing_deps))

0 commit comments

Comments
 (0)