Skip to content

Commit

Permalink
Parse package names from functions in setup.py
Browse files Browse the repository at this point in the history
- Upstream update to parse package names from unresolveable function
  calls in `setup.py`
- Fixes #4292

Signed-off-by: Dan Ryan <[email protected]>
  • Loading branch information
techalchemy committed Jun 1, 2020
1 parent 193a692 commit d58f578
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 2 deletions.
1 change: 1 addition & 0 deletions news/4292.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed an issue with resolving packages with names defined by function calls in ``setup.py``.
1 change: 1 addition & 0 deletions news/4292.vendor.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Updated requirementslib to version ``1.5.11``.
2 changes: 1 addition & 1 deletion pipenv/vendor/requirementslib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from .models.pipfile import Pipfile
from .models.requirements import Requirement

__version__ = "1.5.10"
__version__ = "1.5.11"


logger = logging.getLogger(__name__)
Expand Down
20 changes: 20 additions & 0 deletions pipenv/vendor/requirementslib/models/setup_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -974,6 +974,16 @@ def parse_setup_function(self):
keys = list(setup.keys())
if len(keys) == 1 and keys[0] is None:
_, setup = setup.popitem()
keys = list(setup.keys())
for k in keys:
# XXX: Remove unresolved functions from the setup dictionary
if isinstance(setup[k], dict):
if not setup[k]:
continue
key = next(iter(setup[k].keys()))
val = setup[k][key]
if key in function_names and val is None or val == {}:
setup.pop(k)
return setup


Expand Down Expand Up @@ -1204,6 +1214,16 @@ def ast_parse_setup_py(path):
keys = list(setup.keys())
if len(keys) == 1 and keys[0] is None:
_, setup = setup.popitem()
keys = list(setup.keys())
for k in keys:
# XXX: Remove unresolved functions from the setup dictionary
if isinstance(setup[k], dict):
if not setup[k]:
continue
key = next(iter(setup[k].keys()))
val = setup[k][key]
if key in function_names and val is None or val == {}:
setup.pop(k)
return setup


Expand Down
2 changes: 1 addition & 1 deletion pipenv/vendor/vendor.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ requests==2.23.0
idna==2.9
urllib3==1.25.9
certifi==2020.4.5.1
requirementslib==1.5.10
requirementslib==1.5.11
attrs==19.3.0
distlib==0.3.0
packaging==20.3
Expand Down

0 comments on commit d58f578

Please sign in to comment.