Skip to content
Snippets Groups Projects
Commit 4d89836c authored by Chris Lamb's avatar Chris Lamb :eyes:
Browse files

Rewrite exit_if_paths_do_not_exist to not check files multiple times.

parent d43d580a
No related branches found
No related tags found
No related merge requests found
Pipeline #158304 passed
......@@ -56,12 +56,17 @@ def format_bytes(size, decimal_places=2):
def exit_if_paths_do_not_exist(*paths):
if not all(map(os.path.lexists, paths)):
for path in paths:
if not os.path.lexists(path):
sys.stderr.write(
"%s: %s: No such file or directory\n" % (sys.argv[0], path)
)
flag = False
for path in paths:
if os.path.lexists(path):
continue
flag = True
print(
f"{sys.argv[0]}: {path}: No such file or directory",
file=sys.stderr,
)
if flag:
sys.exit(2)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment