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).
@@ -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):
