Merge pull request #2433 from pypa/bugfix/2421

Update requirementslib to fix #2421
This commit is contained in:
Dan Ryan
2018-06-27 00:48:21 -04:00
committed by GitHub
6 changed files with 12 additions and 6 deletions
+1
View File
@@ -0,0 +1 @@
Fixed an issue reading package names from ``setup.py`` files in projects which imported utilities such as ``versioneer``.
+1
View File
@@ -0,0 +1 @@
Fixed an issue reading package names from ``setup.py`` files in projects which imported utilities such as ``versioneer``.
+1 -1
View File
@@ -1,5 +1,5 @@
# -*- coding=utf-8 -*-
__version__ = "1.0.6"
__version__ = "1.0.7"
from .exceptions import RequirementError
+5 -1
View File
@@ -236,12 +236,14 @@ class FileRequirement(BaseRequirement):
):
from distutils.core import run_setup
old_curdir = os.path.abspath(os.getcwd())
try:
os.chdir(str(self.setup_path.parent))
dist = run_setup(self.setup_path.as_posix(), stop_after="init")
name = dist.get_name()
except (FileNotFoundError, IOError) as e:
dist = None
except (NameError, RuntimeError) as e:
except Exception as e:
from .._compat import InstallRequirement, make_abstract_dist
try:
@@ -257,6 +259,8 @@ class FileRequirement(BaseRequirement):
name = dist.project_name
except (TypeError, ValueError, AttributeError) as e:
dist = None
finally:
os.chdir(old_curdir)
hashed_loc = hashlib.sha256(loc.encode("utf-8")).hexdigest()
hashed_name = hashed_loc[-7:]
if not name or name == "UNKNOWN":
+2 -2
View File
@@ -27,14 +27,14 @@ requests==2.19.1
idna==2.7
urllib3==1.23
certifi==2018.4.16
requirementslib==1.0.6
requirementslib==1.0.7
attrs==18.1.0
distlib==0.2.7
packaging==17.1
pyparsing==2.2.0
pytoml==0.1.16
requirements-parser==0.2.0
shellingham==1.0.0dev1
shellingham==1.1.0dev0
six==1.11.0
semver==2.8.0
shutilwhich==1.1.0
+2 -2
View File
@@ -182,8 +182,8 @@ def test_install_local_vcs_not_in_lockfile(PipenvInstance, pip_src_dir):
# This is the hash of ./six
assert six_key in p.pipfile['packages']
assert six_key in p.lockfile['default']
# Make sure we didn't put six in the lockfile by accident as a vcs ref
assert 'six' not in p.lockfile['default']
# The hash isn't a hash anymore, its actually the name of the package (we now resolve this)
assert 'six' in p.pipfile['packages']
@pytest.mark.vcs