Merge branch 'master' into bugfix/4273

This commit is contained in:
Frost Ming
2020-05-29 15:10:43 +08:00
committed by GitHub
5 changed files with 18 additions and 3 deletions
+1
View File
@@ -0,0 +1 @@
Fix a bug that system-wide packages will be considered when inside a venv.
+1
View File
@@ -0,0 +1 @@
Fix a bug that caused non-specific versions to be pinned in ``Pipfile.lock``.
+2 -2
View File
@@ -330,11 +330,11 @@ class Project(object):
def get_environment(self, allow_global=False):
# type: (bool) -> Environment
if allow_global:
is_venv = is_in_virtualenv()
if allow_global and not is_venv:
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,
+1 -1
View File
@@ -1191,7 +1191,7 @@ def get_locked_dep(dep, pipfile_section, prefer_pipfile=True):
lockfile_name, lockfile_dict = lockfile_entry.copy().popitem()
lockfile_version = lockfile_dict.get("version", "")
# Keep pins from the lockfile
if prefer_pipfile and lockfile_version != version and version.startswith("=="):
if prefer_pipfile and lockfile_version != version and version.startswith("==") and "*" not in version:
lockfile_dict["version"] = version
lockfile_entry[lockfile_name] = lockfile_dict
return lockfile_entry
+13
View File
@@ -748,3 +748,16 @@ def test_lock_nested_vcs_direct_url(PipenvInstance):
assert "git" in p.lockfile["default"]["sibling-package"]
assert "subdirectory" in p.lockfile["default"]["sibling-package"]
assert "version" not in p.lockfile["default"]["sibling-package"]
@pytest.mark.lock
@pytest.mark.install
def test_lock_package_with_wildcard_version(PipenvInstance):
with PipenvInstance(chdir=True) as p:
c = p.pipenv("install 'six==1.11.*'")
assert c.ok
assert "six" in p.pipfile["packages"]
assert p.pipfile["packages"]["six"] == "==1.11.*"
assert "six" in p.lockfile["default"]
assert "version" in p.lockfile["default"]["six"]
assert p.lockfile["default"]["six"]["version"] == "==1.11.0"