Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Load the pip version from the correct prefix #4262

Merged
merged 4 commits into from May 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions news/3506.feature.rst
@@ -0,0 +1 @@
``pipenv install`` and ``pipenv sync`` will no longer attempt to install satisfied dependencies during installation.
1 change: 1 addition & 0 deletions news/4220.bugfix.rst
@@ -0,0 +1 @@
Fixed a bug which caused pipenv to search non-existent virtual environments for ``pip`` when installing using ``--system``.
2 changes: 1 addition & 1 deletion pipenv/core.py
Expand Up @@ -1495,7 +1495,7 @@ def pip_install(
pip_args = get_pip_args(
pre=pre, verbose=environments.is_verbose(), upgrade=True,
selective_upgrade=selective_upgrade, no_use_pep517=not use_pep517,
no_deps=no_deps, require_hashes=not ignore_hashes
no_deps=no_deps, require_hashes=not ignore_hashes,
)
pip_command.extend(pip_args)
if r:
Expand Down
4 changes: 2 additions & 2 deletions pipenv/patched/crayons.py
Expand Up @@ -12,8 +12,8 @@
import re
import sys

import shellingham
import colorama
from pipenv.vendor import shellingham
from pipenv.vendor import colorama

PY3 = sys.version_info[0] >= 3

Expand Down
35 changes: 22 additions & 13 deletions pipenv/project.py
Expand Up @@ -25,7 +25,7 @@
from .environments import (
PIPENV_DEFAULT_PYTHON_VERSION, PIPENV_IGNORE_VIRTUALENVS, PIPENV_MAX_DEPTH,
PIPENV_PIPFILE, PIPENV_PYTHON, PIPENV_TEST_INDEX, PIPENV_VENV_IN_PROJECT,
is_in_virtualenv, is_type_checking
PIPENV_USE_SYSTEM, is_in_virtualenv, is_type_checking
)
from .vendor.requirementslib.models.utils import get_default_pyproject_backend
from .utils import (
Expand Down Expand Up @@ -328,21 +328,30 @@ def pipfile_package_names(self):
"combined": dev_keys | default_keys
}

def get_environment(self, allow_global=False):
# type: (bool) -> Environment
if allow_global:
prefix = sys.prefix
else:
prefix = self.virtualenv_location
is_venv = is_in_virtualenv()
sources = self.sources if self.sources else [DEFAULT_SOURCE]
environment = Environment(
prefix=prefix, is_venv=is_venv, sources=sources, pipfile=self.parsed_pipfile,
project=self
)
pipenv_dist = get_pipenv_dist(pkg="pipenv")
if pipenv_dist:
environment.extend_dists(pipenv_dist)
else:
environment.add_dist("pipenv")
return environment

@property
def environment(self):
if not self._environment:
prefix = self.virtualenv_location
is_venv = is_in_virtualenv()
sources = self.sources if self.sources else [DEFAULT_SOURCE]
self._environment = Environment(
prefix=prefix, is_venv=is_venv, sources=sources, pipfile=self.parsed_pipfile,
project=self
)
pipenv_dist = get_pipenv_dist(pkg="pipenv")
if pipenv_dist:
self._environment.extend_dists(pipenv_dist)
else:
self._environment.add_dist("pipenv")
allow_global = os.environ.get("PIPENV_USE_SYSTEM", PIPENV_USE_SYSTEM)
self._environment = self.get_environment(allow_global=allow_global)
return self._environment

def get_outdated_packages(self):
Expand Down
2 changes: 1 addition & 1 deletion pipenv/vendor/vendor.txt
Expand Up @@ -38,7 +38,7 @@ six==1.14.0
semver==2.9.0
toml==0.10.1
cached-property==1.5.1
vistir==0.5.1
vistir==0.5.2
pip-shims==0.5.2
contextlib2==0.6.0.post1
funcsigs==1.0.2
Expand Down
7 changes: 5 additions & 2 deletions pipenv/vendor/vistir/misc.py
Expand Up @@ -207,11 +207,14 @@ def __init__(
stdout_allowed=False, # type: bool
):
# type: (...) -> None
stdout_encoding = None
stderr_encoding = None
preferred_encoding = getpreferredencoding()
if subprocess is not None:
stdout_encoding = self.get_subprocess_encoding(subprocess, "stdout")
stderr_encoding = self.get_subprocess_encoding(subprocess, "stderr")
self.stdout_encoding = stdout_encoding or PREFERRED_ENCODING
self.stderr_encoding = stderr_encoding or PREFERRED_ENCODING
self.stdout_encoding = stdout_encoding or preferred_encoding
self.stderr_encoding = stderr_encoding or preferred_encoding
self.stdout_lines = []
self.text_stdout_lines = []
self.stderr_lines = []
Expand Down
5 changes: 3 additions & 2 deletions tasks/vendoring/patches/patched/crayons.patch
Expand Up @@ -8,8 +8,9 @@ index 455d3e90..de735daf 100644

-PY3 = sys.version_info[0] >= 3
-
+import shellingham
import colorama
-import colorama
+from pipenv.vendor import shellingham
+from pipenv.vendor import colorama

+PY3 = sys.version_info[0] >= 3
+
Expand Down