Skip to content

Commit

Permalink
get egg_info from client python!
Browse files Browse the repository at this point in the history
Signed-off-by: Kenneth Reitz <me@kennethreitz.org>
  • Loading branch information
kennethreitz committed Sep 24, 2017
1 parent 6cf699c commit 234931b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
5 changes: 4 additions & 1 deletion pipenv/patched/pip/req/req_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -417,9 +417,12 @@ def run_egg_info(self):
self.setup_py, self.link,
)

# Support
PIP_PYTHON_PATH = os.environ.get('PIP_PYTHON_PATH')

with indent_log():
script = SETUPTOOLS_SHIM % self.setup_py
base_cmd = [sys.executable, '-c', script]
base_cmd = [PIP_PYTHON_PATH or sys.executable, '-c', script]
if self.isolated:
base_cmd += ["--no-user-cfg"]
egg_info_cmd = base_cmd + ['egg_info']
Expand Down
16 changes: 9 additions & 7 deletions pipenv/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,17 +324,17 @@ def clean_pkg_version(version):

class HackedPythonVersion(object):
"""A Beautiful hack, which allows us to tell pip which version of Python we're using."""
def __init__(self, python):
self.python = python
def __init__(self, python_version, python_path):
self.python_version = python_version
self.python_path = python_path

def __enter__(self):
if self.python:
os.environ['PIP_PYTHON_VERSION'] = str(self.python)
os.environ['PIP_PYTHON_VERSION'] = str(self.python_version)
os.environ['PIP_PYTHON_PATH'] = str(self.python_path)

def __exit__(self, *args):
# Restore original Python version information.
if self.python:
del os.environ['PIP_PYTHON_VERSION']
del os.environ['PIP_PYTHON_VERSION']


def prepare_pip_source_args(sources, pip_args=None):
Expand Down Expand Up @@ -369,7 +369,9 @@ def resolve_deps(deps, which, which_pip, project, sources=None, verbose=False, p
index_lookup = {}
markers_lookup = {}

with HackedPythonVersion(python):
python_path = which('python')

with HackedPythonVersion(python_version=python, python_path=python_path):

class PipCommand(pip.basecommand.Command):
"""Needed for pip-tools."""
Expand Down

0 comments on commit 234931b

Please sign in to comment.