From 4f33dc8928afb32aaf534a02515c8e90485d1177 Mon Sep 17 00:00:00 2001 From: Dan Ryan Date: Sat, 13 Jul 2019 13:31:55 -0400 Subject: [PATCH] Fix modifications to site packages argument Signed-off-by: Dan Ryan --- pipenv/cli/command.py | 2 +- pipenv/cli/options.py | 8 ++++---- pipenv/core.py | 10 +++++----- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/pipenv/cli/command.py b/pipenv/cli/command.py index 6d89f15a..9bc6fe34 100644 --- a/pipenv/cli/command.py +++ b/pipenv/cli/command.py @@ -70,7 +70,7 @@ def cli( man=False, support=None, help=False, - site_packages=False, + site_packages=None, **kwargs ): # Handle this ASAP to make shell startup fast. diff --git a/pipenv/cli/options.py b/pipenv/cli/options.py index 56b0827e..b2183fec 100644 --- a/pipenv/cli/options.py +++ b/pipenv/cli/options.py @@ -61,7 +61,7 @@ class State(object): self.python = None self.two = None self.three = None - self.site_packages = False + self.site_packages = None self.clear = False self.system = False self.installstate = InstallState() @@ -263,9 +263,9 @@ def site_packages_option(f): state = ctx.ensure_object(State) state.site_packages = value return value - return option("--site-packages", is_flag=True, default=False, type=click.types.BOOL, - help="Enable site-packages for the virtualenv.", callback=callback, - expose_value=False, show_envvar=True)(f) + return option("--site-packages/--no-site-packages", is_flag=True, default=None, + type=click.types.BOOL, help="Enable site-packages for the virtualenv.", + callback=callback, expose_value=False, show_envvar=True)(f) def clear_option(f): diff --git a/pipenv/core.py b/pipenv/core.py index 266a83c2..b7845892 100644 --- a/pipenv/core.py +++ b/pipenv/core.py @@ -466,7 +466,7 @@ def ensure_python(three=None, python=None): return path_to_python -def ensure_virtualenv(three=None, python=None, site_packages=False, pypi_mirror=None): +def ensure_virtualenv(three=None, python=None, site_packages=None, pypi_mirror=None): """Creates a virtualenv, if one doesn't exist.""" from .environments import PIPENV_USE_SYSTEM @@ -500,7 +500,7 @@ def ensure_virtualenv(three=None, python=None, site_packages=False, pypi_mirror= cleanup_virtualenv(bare=False) sys.exit(1) # If --three, --two, or --python were passed… - elif (python) or (three is not None) or (site_packages is not False): + elif (python) or (three is not None) or (site_packages is not None): USING_DEFAULT_PYTHON = False # Ensure python is installed before deleting existing virtual env python = ensure_python(three=three, python=python) @@ -536,7 +536,7 @@ def ensure_project( validate=True, system=False, warn=True, - site_packages=False, + site_packages=None, deploy=False, skip_requirements=False, pypi_mirror=None, @@ -891,7 +891,7 @@ def convert_three_to_python(three, python): return python -def do_create_virtualenv(python=None, site_packages=False, pypi_mirror=None): +def do_create_virtualenv(python=None, site_packages=None, pypi_mirror=None): """Creates a virtualenv.""" click.echo( @@ -1861,7 +1861,7 @@ def do_install( deploy=False, keep_outdated=False, selective_upgrade=False, - site_packages=False, + site_packages=None, ): from .environments import PIPENV_VIRTUALENV, PIPENV_USE_SYSTEM from .vendor.pip_shims.shims import PipError