Commit fdfc4c9b authored by Mike Hommey's avatar Mike Hommey
Browse files

Bug 1662381 - Don't let pipenv initialize the virtualenv with packages from...

Bug 1662381 - Don't let pipenv initialize the virtualenv with packages from pypi. r=rstewart,ahal a=RyanVM

By setting PIP_NO_INDEX when running pipenv, we make it populate the
virtualenv with the in-tree wheels for e.g. pip and setuptools, instead of
whatever happens to be the latest version the day pipenv runs. This
makes it match what we already do for other virtualenvs (with
--no-download in VirtualenvManager.create).

Differential Revision: https://phabricator.services.mozilla.com/D89107
parent 7d973428
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -624,6 +624,7 @@ class VirtualenvManager(object):
        env = ensure_subprocess_env(os.environ.copy())
        env.update(ensure_subprocess_env({
            'PIPENV_IGNORE_VIRTUALENVS': '1',
            'PIP_NO_INDEX': '1',
            'WORKON_HOME': str(os.path.normpath(os.path.join(self.topobjdir, '_virtualenvs')))
        }))
        # On mac, running pipenv with LC_CTYPE set to "UTF-8" (which happens
@@ -663,10 +664,12 @@ class VirtualenvManager(object):

        if pipfile is not None:
            # Install from Pipfile
            env.update(ensure_subprocess_env({
            env_ = env.copy()
            del env_['PIP_NO_INDEX']
            env_.update(ensure_subprocess_env({
                'PIPENV_PIPFILE': str(pipfile)
            }))
            subprocess.check_call([pipenv, 'install'], stderr=subprocess.STDOUT, env=env)
            subprocess.check_call([pipenv, 'install'], stderr=subprocess.STDOUT, env=env_)

        self.virtualenv_root = ensure_venv()