Repository: pypa/pipenv

Issue:
--site-packages is not recognized without --two or --three option
### Issue description

`--site-packages` is not recognized without `--two` or `--three` option.

PR: #3352

### Reason

`site_packages` argument in `cli` function always set to false because `--site-packages` flag was defined in the global state (https://github.com/pypa/pipenv/blob/97657b2797b8a8f045776470d74add6048a95b67/pipenv/cli/options.py#L62). 

However,  with `--two` or `--three` option,  we can run into the block creates virtualenv (https://github.com/pypa/pipenv/blob/97657b2797b8a8f045776470d74add6048a95b67/pipenv/cli/command.py#L201). Since `state.site_packages` is used in this block, pipenv recognizes `--site-packages` flag well and creates virtualenv created with `--system-site-packages`.

### Expected result

`pipenv --site-packgages install` creates virtualenv with `--system-site-packages`

### Actual result

`pipenv --site-packgages install` doesn't create virtualenv that uses system packages.

~~However, `pipenv --two --site-packages install` or `pipenv --three --site-packages` works as expected.~~

*UPDATE*: However `pipenv --two --site-packages install` or `pipenv --three --site-packages` works as expected for the first installation, `pipenv` recreates virtualenv without `--system-site-packages` right after the first install. I think this is a different issue. (`pipenv --two install` also creates twice.)

Alternatively, `pipenv --two --site-packages` works well.

### Steps to replicate

Provide the steps to replicate (which usually at least includes the commands and the Pipfile).

- `$ pipenv --two --site-packages install` (*UPDATE*: or `pipenv --two --site-packages`)

This outputs `Making site-packages available…`.

- `$ pipenv --site-packages install`

This doesn't print `Making site-packages available…`.


Discussion:

Resolving patch:
diff --git a/pipenv/cli/command.py b/pipenv/cli/command.py
--- 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,


Test patch:
diff --git a/tests/integration/test_cli.py b/tests/integration/test_cli.py
--- 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: