Skip to content

Commit

Permalink
Fix FrozenRequirement.to_dist to support pip 19.0
Browse files Browse the repository at this point in the history
In pip 19.0 the function signature of FrozenRequirement.to_dist has
been changed. The last argument 'depedency_links' is now removed as
depedency support has been removed in pip 19.0.

Fixes #113.

Pull request removing dependency links support:
pypa/pip#6060

Commit removing the 'dependency_links' argument:
pypa/pip@46ffb13
  • Loading branch information
naiquevin committed Jan 23, 2019
1 parent 51af7dd commit 41e838c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pipdeptree.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,13 @@ def guess_version(pkg_key, default='?'):
return getattr(m, '__version__', default)


def frozen_req_from_dist(dist):
try:
return FrozenRequirement.from_dist(dist)
except TypeError:
return FrozenRequirement.from_dist(dist, [])


class Package(object):
"""Abstract class for wrappers around objects that pip returns.
Expand Down Expand Up @@ -156,7 +163,7 @@ def render(self, parent=None, frozen=False):

@staticmethod
def frozen_repr(obj):
fr = FrozenRequirement.from_dist(obj, [])
fr = frozen_req_from_dist(obj)
return str(fr).strip()

def __getattr__(self, key):
Expand Down

0 comments on commit 41e838c

Please sign in to comment.