Skip to content
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

Fix --site-packages flag is not recognized #3352

Merged
merged 5 commits into from
Dec 8, 2018
Merged

Conversation

nonylene
Copy link
Contributor

@nonylene nonylene commented Dec 4, 2018

The issue

#3351

site_packages argument in cli function always set to false because --site-packages flag was defined in the global state (

self.site_packages = False
).

The fix

Remove site_packages argument form cli function and make use state.site_packages.

The checklist

  • Associated issue
  • A news fragment in the news/ directory to describe this fix with the extension .bugfix, .feature, .behavior, .doc. .vendor. or .trivial (this will appear in the release changelog). Use semantic line breaks and name the file after the issue number or the PR #.

`site_packages` argument in `cli` function always set to false because `--site-packages` flag was defined in global state (https://github.com/pypa/pipenv/blob/97657b2797b8a8f045776470d74add6048a95b67/pipenv/cli/options.py#L62). 

Fixes pypa#3351
@jxltom
Copy link
Contributor

jxltom commented Dec 5, 2018

Thanks for this. It is because expose_value=False is used for --site-packages option as in

return option("--system", is_flag=True, default=False, help="System pip management.",
callback=callback, type=click.types.BOOL, expose_value=False,
show_envvar=True)(f)
.

We should also check options with expose_value=False but used in

def cli(
ctx,
state,
where=False,
venv=False,
rm=False,
bare=False,
three=False,
python=False,
help=False,
py=False,
site_packages=False,
envs=False,
man=False,
completion=False,
pypi_mirror=None,
support=None,
clear=False,
**kwargs
):
.

BTW, it will be nice if you also include tests for this. Thanks!

@jxltom jxltom added the Category: Tests Relates to tests. label Dec 5, 2018
@jxltom
Copy link
Contributor

jxltom commented Dec 5, 2018

I checked that --clear has same issue, and made PR #3354 for that.

@techalchemy
Copy link
Member

To be honest we just need a thing that tests every CLI flag and makes sure it makes it through to the corresponding function

@jxltom
Copy link
Contributor

jxltom commented Dec 5, 2018

Yes, it will be nice to test the behavior as well. :D

@nonylene
Copy link
Contributor Author

nonylene commented Dec 8, 2018

Test added in f81e861.

@techalchemy
Copy link
Member

awesome, thank you so much for handling this! 🍰

@techalchemy techalchemy removed the Category: Tests Relates to tests. label Dec 8, 2018
@techalchemy techalchemy merged commit 7a2bdfe into pypa:master Dec 8, 2018
@nonylene
Copy link
Contributor Author

nonylene commented Dec 8, 2018

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants