Changeset View
Changeset View
Standalone View
Standalone View
swh/loader/package/npm.py
Show First 20 Lines • Show All 79 Lines • ▼ Show 20 Lines | def resolve_revision_from( | ||||
return rev_id | return rev_id | ||||
return None | return None | ||||
def build_revision( | def build_revision( | ||||
self, a_metadata: Dict, uncompressed_path: str) -> Dict: | self, a_metadata: Dict, uncompressed_path: str) -> Dict: | ||||
i_metadata = extract_intrinsic_metadata(uncompressed_path) | i_metadata = extract_intrinsic_metadata(uncompressed_path) | ||||
# from intrinsic metadata | # from intrinsic metadata | ||||
author = extract_npm_package_author(i_metadata) | author = extract_npm_package_author(i_metadata) | ||||
# extrinsic metadata | message = i_metadata['version'].encode('ascii') | ||||
version = i_metadata['version'] | |||||
date = self.info['time'][version] | # from extrinsic metadata | ||||
# No date available in intrinsic metadata: retrieve it from the API | |||||
# metadata, using the version number that the API claims this package | |||||
# has. | |||||
extrinsic_version = a_metadata['version'] | |||||
date = self.info['time'][extrinsic_version] | |||||
date = iso8601.parse_date(date) | date = iso8601.parse_date(date) | ||||
date = normalize_timestamp(int(date.timestamp())) | date = normalize_timestamp(int(date.timestamp())) | ||||
message = version.encode('ascii') | |||||
return { | return { | ||||
'type': 'tar', | 'type': 'tar', | ||||
'message': message, | 'message': message, | ||||
'author': author, | 'author': author, | ||||
'date': date, | 'date': date, | ||||
'committer': author, | 'committer': author, | ||||
'committer_date': date, | 'committer_date': date, | ||||
▲ Show 20 Lines • Show All 195 Lines • Show Last 20 Lines |