-
Notifications
You must be signed in to change notification settings - Fork 7
Apply bundle.yml options in command-line order #31
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
base: develop
Are you sure you want to change the base?
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #31 +/- ##
==========================================
Coverage ? 40.71%
==========================================
Files ? 48
Lines ? 10133
Branches ? 0
==========================================
Hits ? 4126
Misses ? 6007
Partials ? 0 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
8a559f4 to
9432e26
Compare
|
Thank you for the suggestion. Also this class |
In a system as complicated as the IFS we have lots of places where options are added as defaults, but the user can negate them; it's not the user that would be explicitly adding both options, but choosing to override a default. At the moment we're managing by carefully planning what defaults are in place and thus which options will be the 'overrides' and thus should come second, but it all feels rather precarious. Something like this would make things a lot more robust.
I understand exposing sys.argv isn't ideal, but I couldn't see a better solution (I'm open to suggestions!). Unless I've made a mistake - I did test the changes against the IFS - if there are no bundle options in the argument list then this block will do nothing, the same as before. |
|
As an attempt to find a solution that works for everyone - if I could achieve the same result cleanly by extending the ArgumentParser class, without exposing argv, would that be acceptable? This functionality really would be useful when we have multiple ways of wanting to run the IFS, each requiring different default setups. |
|
Hi @cresswellp , if you mean that you can modify/extend the Argparse class so it would be able to take care of duplicate entries, and overwriting the previous ones in order that would be great! |
Description
Command line options defined in bundle.yml are always applied in the order they're processed by argparse, i.e. in the order they're defined in the bundle. This means that e.g. if two options
with-fooandwithout-foosetBUILD_foo=ONandBUILD_foo=OFFrespectively, then both--with-foo --without-fooand--without-foo --with-foowill produce the same result, which depends only on which option is defined first in bundle.yml. This is an inherent restriction of argparse.Processing the bundle.yml options (and only the bundle.yml options) in the order they're passed to ecbundle removes this restriction. This doesn't affect all command line options, e.g. arguments passed by
--cmakewill still be processed after any bundle-defined options, but this seems to provide sufficient flexibility for users to be able to obtain the desired result.Contributor Declaration
By opening this pull request, I affirm the following: