Changeset View
Changeset View
Standalone View
Standalone View
swh/loader/package/pypi/loader.py
Show First 20 Lines • Show All 123 Lines • ▼ Show 20 Lines | class PyPILoader(PackageLoader[PyPIPackageInfo]): | ||||
def build_revision( | def build_revision( | ||||
self, p_info: PyPIPackageInfo, uncompressed_path: str, directory: Sha1Git | self, p_info: PyPIPackageInfo, uncompressed_path: str, directory: Sha1Git | ||||
) -> Optional[Revision]: | ) -> Optional[Revision]: | ||||
i_metadata = extract_intrinsic_metadata(uncompressed_path) | i_metadata = extract_intrinsic_metadata(uncompressed_path) | ||||
if not i_metadata: | if not i_metadata: | ||||
return None | return None | ||||
# from intrinsic metadata | # from intrinsic metadata | ||||
name = i_metadata["version"] | version = i_metadata.get("version", "") | ||||
_author = author(i_metadata) | _author = author(i_metadata) | ||||
# from extrinsic metadata | # from extrinsic metadata | ||||
message = p_info.comment_text or "" | message = p_info.comment_text or "" | ||||
message = "%s: %s" % (name, message) if message else name | message = "%s: %s" % (version, message) if message else version | ||||
date = TimestampWithTimezone.from_iso8601(p_info.upload_time) | date = TimestampWithTimezone.from_iso8601(p_info.upload_time) | ||||
return Revision( | return Revision( | ||||
type=RevisionType.TAR, | type=RevisionType.TAR, | ||||
message=message.encode("utf-8"), | message=message.encode("utf-8"), | ||||
author=_author, | author=_author, | ||||
date=date, | date=date, | ||||
committer=_author, | committer=_author, | ||||
▲ Show 20 Lines • Show All 91 Lines • Show Last 20 Lines |