-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
check-software: update to accept module arguments #2769
check-software: update to accept module arguments #2769
Conversation
|
Thanks for not forgetting about this 👍 |
bin/cylc-check-software
Outdated
else check for all package dependencies and print the results in a table. | ||
""" | ||
# Check for valid module argument; if present return 0 or 1 for pass/fail. | ||
if len(sys.argv) > 1: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we check for multiple dependencies with a for loop here? Also, I think it would be nicer to signal success/failure through exit code rather than STDOUT. How about the following?
exit_code = 0
for cmd_arg in sys.argv[1:]:
mod_arg = upper_case_conv.get(cmd_arg.lower(), cmd_arg.lower())
if mod_arg not in module_args:
sys.stderr.write('No such module in the software dependencies: ' +
cmd_arg + '\n')
exit_code = max(exit_code, 2)
else:
exit_code = max(exit_code, individual_status_print(mod_arg))
if len(sys.argv) > 1:
sys.exit(exit_code)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, sorry, an exit code would be more appropriate. Okay, we can accept multiple dependency arguments too.
72944e7
to
30128ba
Compare
|
7527e76
to
74fc6be
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One minor typo: in the first line of command help [ARGS]
should be [MODULES]
(and no need for ...
as plural already).
74fc6be
to
69c3297
Compare
Well spotted @hjoliver! I've rectified that in a new commit & squashed it into the original. |
As requested in #2734 (comment), return a zero or non-zero output for a software dependency pass or fail, respectively.
cylc check-software
will under this implementation accept as an argument any module listed in the specification (the keys underopt_spec
, including the lower-case form). Without arguments it behaves as before.