From 64ae1ed8a4234e5d5b94c10e18b109a58572f3c7 Mon Sep 17 00:00:00 2001 From: nonylene Date: Wed, 5 Dec 2018 06:19:32 +0900 Subject: [PATCH 1/4] Fix `--site-packages` flag is not recognized `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 #3351 --- pipenv/cli/command.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pipenv/cli/command.py b/pipenv/cli/command.py index ae7111f1a0..ec1bef6138 100644 --- a/pipenv/cli/command.py +++ b/pipenv/cli/command.py @@ -70,7 +70,6 @@ def cli( python=False, help=False, py=False, - site_packages=False, envs=False, man=False, completion=False, @@ -198,7 +197,7 @@ def cli( ) ctx.abort() # --two / --three was passed… - if (state.python or state.three is not None) or site_packages: + if (state.python or state.three is not None) or state.site_packages: ensure_project( three=state.three, python=state.python, From eff802a62da7292c39e62449f2cbcad46bb48277 Mon Sep 17 00:00:00 2001 From: nonylene Date: Wed, 5 Dec 2018 06:28:36 +0900 Subject: [PATCH 2/4] Create 3352.bugfix.rst --- news/3352.bugfix.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 news/3352.bugfix.rst diff --git a/news/3352.bugfix.rst b/news/3352.bugfix.rst new file mode 100644 index 0000000000..d2d9c675f0 --- /dev/null +++ b/news/3352.bugfix.rst @@ -0,0 +1 @@ +Fix a bug that ``--site-packages`` flag is not recognized. From e229f7e03812910ba78373f0ca4cb193e57915b3 Mon Sep 17 00:00:00 2001 From: nonylene Date: Wed, 5 Dec 2018 06:41:06 +0900 Subject: [PATCH 3/4] Rename 3352.bugfix.rst to 3351.bugfix.rst --- news/{3352.bugfix.rst => 3351.bugfix.rst} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename news/{3352.bugfix.rst => 3351.bugfix.rst} (100%) diff --git a/news/3352.bugfix.rst b/news/3351.bugfix.rst similarity index 100% rename from news/3352.bugfix.rst rename to news/3351.bugfix.rst From f81e86181ce828768a5f03c25c695394ad90ad29 Mon Sep 17 00:00:00 2001 From: nonylene Date: Sun, 9 Dec 2018 05:17:25 +0900 Subject: [PATCH 4/4] Add test for `pipenv --python --site-packages` --- tests/integration/test_cli.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/integration/test_cli.py b/tests/integration/test_cli.py index 946b98f755..a38883e0ed 100644 --- a/tests/integration/test_cli.py +++ b/tests/integration/test_cli.py @@ -41,6 +41,20 @@ def test_pipenv_py(PipenvInstance): assert os.path.basename(python).startswith('python') +@pytest.mark.cli +def test_pipenv_site_packages(PipenvInstance): + with PipenvInstance() as p: + c = p.pipenv('--python python --site-packages') + assert c.return_code == 0 + assert 'Making site-packages available' in c.err + + # no-global-site-packages.txt under stdlib dir should not exist. + c = p.pipenv('run python -c "import sysconfig; print(sysconfig.get_path(\'stdlib\'))"') + assert c.return_code == 0 + stdlib_path = c.out.strip() + assert not os.path.isfile(os.path.join(stdlib_path, 'no-global-site-packages.txt')) + + @pytest.mark.cli def test_pipenv_support(PipenvInstance): with PipenvInstance() as p: