Skip to content

Commit

Permalink
Use prepare_metadata with Pip 19 instead of run_egg_info
Browse files Browse the repository at this point in the history
Newer Pip [1] doesn't fill the requirement metadata anymore with the
"run_egg_info" method, but a new method named "prepare_metadata" should
be used instead.  Make the "name_from_ireq" helper function to call the
new method when it's available.

[1] pypa/pip#5743
  • Loading branch information
suutari committed Jan 27, 2019
1 parent 307b2e6 commit a3ee4b0
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions prequ/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,11 @@ def name_from_ireq(ireq):
"""
if not ireq.req:
ireq.source_dir = os.path.abspath(ireq.source_dir)
ireq.run_egg_info()
assert ireq.req, "run_egg_info should fill req: {!r}".format(ireq)
if hasattr(ireq, 'prepare_metadata'):
ireq.prepare_metadata()
else:
ireq.run_egg_info()
assert ireq.req, "prepare_metadata should fill req: {!r}".format(ireq)
return name_from_req(ireq.req)


Expand Down

0 comments on commit a3ee4b0

Please sign in to comment.