Adds --user flag to freeze subcommand. #803

Merged
merged 0 commits into from Dec 27, 2013

5 participants

@schwa

Throws a CommandError if combined with the --local flag.
Adds a further "user_only" filter to util.get_installed_distibutions.
By default (without the presence of the --user flag) the filter if off.

Fixes #802

@qwcode qwcode and 1 other commented on an outdated diff Feb 10, 2013
pip/commands/freeze.py
## FIXME: Obviously this should be settable:
find_tags = False
skip_match = None
+ if options.user and options.local:
+ raise CommandError("Cannot combine --user and --local")
@qwcode
qwcode added a note Feb 10, 2013

in virtualenvs that have global access, they also have access to the user site.
so, I could imagine wanting some way to get the virtualenv packages and the user packages, but excluding all the global stuff.

@schwa
schwa added a note Feb 10, 2013

Yeah I'm not really sure the ins & outs of virtualenvs. What do you suggest changing here?

@qwcode
qwcode added a note Feb 10, 2013

1) change get_installed_distributions so that it has a different OR check when both local_only and user_only are provided.
2) throw a commanderror when someone tries to pass --user and location.virtualenv_no_global() is true. i.e. when you're in a no-global virtualenv, you have no visibility to the user site. Or better, don't even add the --user option when that's true.

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

can you update tests.test_utils.Tests_get_installed_distributions ?

@schwa

I'm looking at adding the tests - but am unfamiliar with mock & co… so it's going to take a while.

@schwa

Added unit tests.

@schwa schwa referenced this pull request in nvie/pip-tools Jul 3, 2013
Closed

Add --user switch #45

@thedrow

But the build fails since travis does not expose user packages under it's virtualenv. How do we verify that it works?

@schwa

Yeah not sure... Might be one of those things that could be untestable?

@thedrow

@schwa Try to contact travis ci support and see if they can help.

@keimlink

Any news on the travis testing problem? Is there anything I can do to get this pull request done?

@qwcode

the test is using reset_env (which creates an isolated scripttest environment) which supports --user installs (by manipulating PYTHONUSERBASE), so no need to be concerned with travis support on this.

the fix is to do this reset_env(system_site_packages=True) to make the the user site visible in the virtualenv created by reset_env.

as for getting this merged, I intend to merge a number of --user related changes/fixes for 1.5, so I will get to this.

@thedrow

@schwa Could you please fix the test according to @qwcode findings?

@schwa

Finally updated the pull request as per @qwcode

@thedrow

@schwa You might have forgotten to import reset_env.

@qwcode qwcode merged commit 245057c into pypa:develop Dec 27, 2013

1 check passed

Details default The Travis CI build passed
@keimlink

The information at the top says "0 additions, 0 deletions". Why is that? What happend to the patch?

@qwcode

I didn't merge this. github quirk. looks like @schwa updated his develop branch.
better to submit PRs from a non-develop branch.

@keimlink

Thanks for clarifying this. My first thought was that the feature had been added. Is such a feature still of interest?

@guettli

I am not the creator of this ticket. But I switched from the user scheme, to virtualenv in $HOME. For me this can be left closed.

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