Skip to content

Commit

Permalink
Merge pull request #2433 from pypa/bugfix/2421
Browse files Browse the repository at this point in the history
Update requirementslib to fix #2421
  • Loading branch information
techalchemy authored Jun 27, 2018
2 parents 6f47cd6 + 1fd2247 commit 9d992a6
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 6 deletions.
1 change: 1 addition & 0 deletions news/2433.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed an issue reading package names from ``setup.py`` files in projects which imported utilities such as ``versioneer``.
1 change: 1 addition & 0 deletions news/2433.vendor
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed an issue reading package names from ``setup.py`` files in projects which imported utilities such as ``versioneer``.
2 changes: 1 addition & 1 deletion pipenv/vendor/requirementslib/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding=utf-8 -*-
__version__ = "1.0.6"
__version__ = "1.0.7"


from .exceptions import RequirementError
Expand Down
6 changes: 5 additions & 1 deletion pipenv/vendor/requirementslib/models/requirements.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,12 +236,14 @@ def get_name(self):
):
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:
Expand All @@ -257,6 +259,8 @@ def get_name(self):
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":
Expand Down
4 changes: 2 additions & 2 deletions pipenv/vendor/vendor.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/test_install_uri.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9d992a6

Please sign in to comment.