Fix bug in spack flake8 when no files differ from develop (#5898)

This commit is contained in:
Todd Gamblin 2017-10-24 11:29:18 +02:00 committed by GitHub
parent 896d4c8d0c
commit 3f68cc2ba7

View File

@ -264,6 +264,7 @@ def prefix_relative(path):
package_file_list = [f for f in file_list if is_package(f)]
file_list = [f for f in file_list if not is_package(f)]
returncode = 0
with working_dir(temp):
output = ''
if file_list:
@ -271,12 +272,14 @@ def prefix_relative(path):
'--format', 'pylint',
'--config=%s' % os.path.join(spack.prefix, '.flake8'),
*file_list, fail_on_error=False, output=str)
returncode |= flake8.returncode
if package_file_list:
output += flake8(
'--format', 'pylint',
'--config=%s' % os.path.join(spack.prefix,
'.flake8_packages'),
*package_file_list, fail_on_error=False, output=str)
returncode |= flake8.returncode
if args.root_relative:
# print results relative to repo root.
@ -290,7 +293,7 @@ def cwd_relative(path):
for line in output.split('\n'):
print(re.sub(r'^(.*): \[', cwd_relative, line))
if flake8.returncode != 0:
if returncode != 0:
print('Flake8 found errors.')
sys.exit(1)
else: