-
Notifications
You must be signed in to change notification settings - Fork 452
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
Re-harmonize argument parsing between distutils and optparse CLIs #389
Conversation
Current coverage is
|
Assigning @jtwang just to have some eyes on this. |
(Pretend I'm jtwang), shipit! I'm not super familiar with the different ways users can do option parsing, but the logic looks fine and you've got it tested. Hopefully this doesn't introduce any more regressions. :) |
@@ -39,6 +39,48 @@ | |||
from configparser import RawConfigParser | |||
|
|||
|
|||
def listify_value(arg, split=None): |
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.
Will a single arg ever contain quotes/whitespace? Eg "foo "i am a.zip" bar"
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.
That sort of usage will never have been (how's that for a temporal form?) supported by Babel... At least not the distutils frontend. (Sneaky edit: distutils, not optparse)
Double edit: Keyword strings should never contain significant whitespace, so that shouldn't matter, actually. Directory/path args are separated by other characters.
@ENuge: Mind taking one more look? |
@@ -825,6 +882,7 @@ def _configure_command(self, cmdname, argv): | |||
strs = ["--%s" % name] | |||
if short: | |||
strs.append("-%s" % short) | |||
strs.extend(cmdclass.option_aliases.get(name, ())) |
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.
Checking if this, combined with strs = ["--%s" % name]
, doesn't cause any problems? If name
is "output" you'll end up with strs being ['--output', --output']. I don't have a super solid understanding of all the different options uh, options, so for all I know this intentional. If not an issue, shipit! Everything else looks good to me.
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.
Oop, good catch.
The alias mapping should be 'output-file': ('--output',)
...
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.
(and as of ee8abd6, it is.)
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.
Err, oh. I don't know why I was looking at the old version. Shipit!
Now that arguments are more likely to be unicode than bytestrings, %r is not a good idea between Python versions.
So yeah, with that last comment fixed, merging. Will roll another bugfix release tomorrow. |
I so hope this will be the last we see of this series of bugs...
Fixes #388
Fixes #390
Refs #384
Refs #311