mirror of
https://github.com/pypa/pip
synced 2023-12-13 21:30:23 +01:00
Use req to populate candidate line instead of link
This ensures a candidate built from a "found" link (from e.g. index) is categorized as specifier-based, not URL-based. This is important to avoid a specifier-based candidate to be 'pip freeze'-ed in the direct URL form due to PEP 610 (direct-url.json).
This commit is contained in:
parent
daff81124a
commit
e03614fe6d
|
@ -41,8 +41,12 @@ logger = logging.getLogger(__name__)
|
|||
def make_install_req_from_link(link, parent):
|
||||
# type: (Link, InstallRequirement) -> InstallRequirement
|
||||
assert not parent.editable, "parent is editable"
|
||||
return install_req_from_line(
|
||||
link.url,
|
||||
if parent.req:
|
||||
line = str(parent.req)
|
||||
else:
|
||||
line = link.url
|
||||
ireq = install_req_from_line(
|
||||
line,
|
||||
comes_from=parent.comes_from,
|
||||
use_pep517=parent.use_pep517,
|
||||
isolated=parent.isolated,
|
||||
|
@ -53,6 +57,10 @@ def make_install_req_from_link(link, parent):
|
|||
hashes=parent.hash_options
|
||||
),
|
||||
)
|
||||
if ireq.link is None:
|
||||
ireq.link = link
|
||||
# TODO: Handle wheel cache resolution.
|
||||
return ireq
|
||||
|
||||
|
||||
def make_install_req_from_editable(link, parent):
|
||||
|
|
Loading…
Reference in a new issue