Fix bug in spack flake8 when no files differ from develop (#5898)
This commit is contained in:
parent
896d4c8d0c
commit
3f68cc2ba7
@ -264,6 +264,7 @@ def prefix_relative(path):
|
|||||||
package_file_list = [f for f in file_list if is_package(f)]
|
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)]
|
file_list = [f for f in file_list if not is_package(f)]
|
||||||
|
|
||||||
|
returncode = 0
|
||||||
with working_dir(temp):
|
with working_dir(temp):
|
||||||
output = ''
|
output = ''
|
||||||
if file_list:
|
if file_list:
|
||||||
@ -271,12 +272,14 @@ def prefix_relative(path):
|
|||||||
'--format', 'pylint',
|
'--format', 'pylint',
|
||||||
'--config=%s' % os.path.join(spack.prefix, '.flake8'),
|
'--config=%s' % os.path.join(spack.prefix, '.flake8'),
|
||||||
*file_list, fail_on_error=False, output=str)
|
*file_list, fail_on_error=False, output=str)
|
||||||
|
returncode |= flake8.returncode
|
||||||
if package_file_list:
|
if package_file_list:
|
||||||
output += flake8(
|
output += flake8(
|
||||||
'--format', 'pylint',
|
'--format', 'pylint',
|
||||||
'--config=%s' % os.path.join(spack.prefix,
|
'--config=%s' % os.path.join(spack.prefix,
|
||||||
'.flake8_packages'),
|
'.flake8_packages'),
|
||||||
*package_file_list, fail_on_error=False, output=str)
|
*package_file_list, fail_on_error=False, output=str)
|
||||||
|
returncode |= flake8.returncode
|
||||||
|
|
||||||
if args.root_relative:
|
if args.root_relative:
|
||||||
# print results relative to repo root.
|
# print results relative to repo root.
|
||||||
@ -290,7 +293,7 @@ def cwd_relative(path):
|
|||||||
for line in output.split('\n'):
|
for line in output.split('\n'):
|
||||||
print(re.sub(r'^(.*): \[', cwd_relative, line))
|
print(re.sub(r'^(.*): \[', cwd_relative, line))
|
||||||
|
|
||||||
if flake8.returncode != 0:
|
if returncode != 0:
|
||||||
print('Flake8 found errors.')
|
print('Flake8 found errors.')
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user