diff --git a/src/fromager/candidate.py b/src/fromager/candidate.py index e7a824a3..2fee169a 100644 --- a/src/fromager/candidate.py +++ b/src/fromager/candidate.py @@ -38,12 +38,18 @@ def __init__( self._metadata: Metadata | None = None self._dependencies: list[Requirement] | None = None + self.metadata_source: str | None = None def __repr__(self) -> str: if not self.extras: return f"<{self.name}=={self.version}>" return f"<{self.name}[{','.join(self.extras)}]=={self.version}>" + def _pep_658_metadata(self): + # This function will download the metadata file from metadata_source url. + # Where do we save this? We will use seesions.get(self.metadata_source, stream=True) + pass + @property def metadata(self) -> Metadata: if self._metadata is None: diff --git a/src/fromager/resolver.py b/src/fromager/resolver.py index b8c3ca56..f587910e 100644 --- a/src/fromager/resolver.py +++ b/src/fromager/resolver.py @@ -109,6 +109,9 @@ def get_project_from_pypi( for i in doc.findall(".//a"): candidate_url = urljoin(simple_index_url, i.attrib["href"]) py_req = i.attrib.get("data-requires-python") + # As per PEP 658, the metadata file will be present separately in anchor tag "data-dist-info-metadata" + candidate_metadata_attr = i.attrib.get("data-dist-info-metadata") + candidate_metadata_url = urljoin(simple_index_url, candidate_metadata_attr) path = urlparse(candidate_url).path filename = path.rsplit("/", 1)[-1] if DEBUG_RESOLVER: @@ -178,6 +181,7 @@ def get_project_from_pypi( is_sdist=is_sdist, build_tag=build_tag, ) + c.metadata_source = candidate_metadata_url if DEBUG_RESOLVER: logger.debug( "%s: candidate %s (%s) %s", project, filename, c, candidate_url