MCPcopy Create free account
hub / github.com/astral-sh/python-build-standalone / destination_to_source_name

Function destination_to_source_name

pythonbuild/mirror.py:111–128  ·  view source on GitHub ↗
(dest_name: str, tag: str, build_datetime: str)

Source from the content-addressed store, hash-verified

109
110
111def destination_to_source_name(dest_name: str, tag: str, build_datetime: str) -> str:
112 pattern = DESTINATION_TAG_RE_TEMPLATE.format(tag=re.escape(tag))
113 if (match := re.match(pattern, dest_name)) is None:
114 raise MirrorError(
115 f"release filename does not contain expected tag {tag}: {dest_name}"
116 )
117
118 source_name = f"{match.group(1)}-{match.group(2)}"
119
120 if source_name.endswith("-full.tar.zst"):
121 prefix = source_name.removesuffix("-full.tar.zst")
122 return f"{prefix}-{build_datetime}.tar.zst"
123
124 if source_name.endswith(".tar.gz"):
125 prefix = source_name.removesuffix(".tar.gz")
126 return f"{prefix}-{build_datetime}.tar.gz"
127
128 raise MirrorError(f"unsupported release filename: {dest_name}")
129
130
131def build_upload_entries(

Calls 1

MirrorErrorClass · 0.85