rewriter: allow reading dict-valued kwargs; improve key-value pairs in CLI; minor improvements#14740
Conversation
|
Fixes: #14739 |
|
@bonzini Nope, this PR allows reading dict-valued kwargs but not writing them. |
d60fd11 to
98c5d44
Compare
The project ID must be "/" and cannot be an arbitrary string.
Fixes: e81acbd ("Use a single coredata dictionary for options")
Many rewriter subcommands expect key/value pairs as adjacent arguments. If the last value is missing, show a user-friendly error instead of a backtrace. For: mesonbuild#13234
|
This all looks good to me. I'm not sure if we can land the |
|
Well, the documentation says:
No doubt users are depending on it anyway, but at least there's guidance we can point to. |
|
There was even a bug that wasn't closed, so I think it is doable... Maybe detect an empty even-position value and ignore it with a warning, so that it's at least possible to write a script that works for both old and new? Does it make sense for any rewriter use case to use empty keys? |
The `default-options delete` and `kwargs delete` subcommands required key/value pairs, where the key was deleted and the specified value was ignored. This matches the JSON script mode interface but is unpleasant as a CLI. Have the CLI `delete` commands accept a list of keys instead. We can make this change because the UI is documented to be unstable. However, to allow scripts to work with both old and new Meson, ignore even-numbered arguments if they're all equal to the empty string. Fixes: mesonbuild#13234
We can't modify dict-valued kwargs (mesonbuild#14739) but this lets us at least read them.
Good idea, done. Empty keys don't make sense; |
dcbaker
left a comment
There was a problem hiding this comment.
LGTM me. Thanks for dealing with the backwards compat questions, I don't like asking them and I know no one likes dealing with them :D
|
@dcbaker this was approved months ago, anything blocking the merge? |
|
Just my memory :( |
kwargs infofor dict-valued kwargs. We can't modify these yet but it's useful to be able to read them.default-options deleteandkwargs deletesubcommands required key/value pairs, where the key was deleted and the specified value was ignored. This matches the JSON script mode interface but is unpleasant as a CLI. Since the UI is documented to be unstable, we can change this. Have the CLIdeletecommands accept a list of keys instead.meson rewrite kwargs delete project / <option>raises unhandled exception unless a dummy second value is passed #13234meson rewrite kwargs delete project / <option>raises unhandled exception unless a dummy second value is passed #13234license_fileskwarg toproject().