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

Port help #6144

Merged
merged 4 commits into from Jul 17, 2018

Conversation

Projects
None yet
2 participants
@Eric-Arellano
Copy link
Contributor

Eric-Arellano commented Jul 16, 2018

Part of #6062.

Eric-Arellano added some commits Jul 16, 2018

do_test(['--foo'], {}, ['--foo=<str>'], ['--foo'])
str_repr = 'newstr' if PY2 else 'str'

do_test(['--foo'], {}, ['--foo=<{}>'.format(str_repr)], ['--foo'])

This comment has been minimized.

@Eric-Arellano

Eric-Arellano Jul 16, 2018

Contributor

This fix gets the tests to pass, but I want to make sure this doesn't break a contract anyone is depending upon.

The backport of str means in Py2 the help parameter's type will be newstr. Beyond the difference between unicode vs bytes, does anything depend on the representation being str? That is, is it fine that newstr is only str-like (duck typing). I would imagine this is fine and think the test has only hardcoded checking for str as a way to ensure the parameter is a string and not something like an int.

This comment has been minimized.

@stuhood

stuhood Jul 16, 2018

Member

AFAICT, this will actually end up changing ./pants help to render newstr, which isn't ideal. Adding a special case for the rendering of this help would be preferable... maybe here:

metavar = '<{}>'.format(typ.__name__)

This comment has been minimized.

@Eric-Arellano

Eric-Arellano Jul 16, 2018

Contributor

You're right! Good catch, thanks.

@stuhood
Copy link
Member

stuhood left a comment

Thanks!

@stuhood

This comment has been minimized.

Copy link
Member

stuhood commented Jul 17, 2018

Will merge afterhours.

@stuhood stuhood merged commit b0c86ce into pantsbuild:master Jul 17, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@Eric-Arellano Eric-Arellano deleted the Eric-Arellano:port-help branch Jul 22, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment