Merge branch 'master' into fix-verbosity-var

This commit is contained in:
Pior Bastida
2018-10-22 18:31:05 -04:00
4 changed files with 28 additions and 3 deletions
+1
View File
@@ -0,0 +1 @@
Fixed unnecessary extras are added when translating markers
+2 -2
View File
@@ -926,8 +926,8 @@ class Project(object):
@property
def _pyversion(self):
include_dir = vistir.compat.Path(self.virtualenv_location) / "include"
python_path = next(iter(list(include_dir.iterdir())), None)
if python_path and python_path.name.startswith("python"):
python_path = next((x for x in include_dir.iterdir() if x.name.startswith("python")), None)
if python_path:
python_version = python_path.name.replace("python", "")
py_version_short, abiflags = python_version[:3], python_version[3:]
return {"py_version_short": py_version_short, "abiflags": abiflags}
+3 -1
View File
@@ -1182,7 +1182,9 @@ def translate_markers(pipfile_entry):
new_pipfile = dict(pipfile_entry).copy()
marker_set = set()
if "markers" in new_pipfile:
marker_set.add(str(Marker(new_pipfile.get("markers"))))
marker = str(Marker(new_pipfile.pop("markers")))
if 'extra' not in marker:
marker_set.add(marker)
for m in pipfile_markers:
entry = "{0}".format(pipfile_entry[m])
if m != "markers":
+22
View File
@@ -167,6 +167,28 @@ maya = "*"
assert c.return_code == 0
@pytest.mark.extras
@pytest.mark.lock
def test_lock_extras_without_install(PipenvInstance, pypi):
with PipenvInstance(pypi=pypi) as p:
with open(p.pipfile_path, 'w') as f:
contents = """
[packages]
requests = {version = "*", extras = ["socks"]}
""".strip()
f.write(contents)
c = p.pipenv('lock')
assert c.return_code == 0
assert "requests" in p.lockfile["default"]
assert "pysocks" in p.lockfile["default"]
assert "markers" not in p.lockfile["default"]['pysocks']
c = p.pipenv('lock -r')
assert c.return_code == 0
assert "extra == 'socks'" not in c.out.strip()
@pytest.mark.extras
@pytest.mark.lock
@pytest.mark.complex