Skip to content

Commit d912a63

Browse files
committed
less code repack, make it simple.
1 parent b723678 commit d912a63

File tree

1 file changed

+5
-23
lines changed

1 file changed

+5
-23
lines changed

.github/scripts/repack_wheels.py

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
"""
2+
if you want to repack with details, please check the git log, before “less code repack, make it simple.”
3+
"""
4+
15
import shutil
26
import subprocess
37
import sys
@@ -20,16 +24,6 @@ def _load_setup_template(template_path: Path, version: str) -> str:
2024
return template.replace("__VERSION__", version)
2125

2226

23-
def _parse_wheel_tags(filename: str) -> tuple[str, str, str]:
24-
name = filename
25-
if name.endswith(".whl"):
26-
name = name[:-4]
27-
parts = name.split("-")
28-
if len(parts) < 5:
29-
raise SystemExit(f"Invalid wheel filename: {filename}")
30-
return parts[-3], parts[-2], parts[-1]
31-
32-
3327
def main() -> None:
3428
repo_root = Path.cwd()
3529
dist_dir = repo_root / "dist"
@@ -61,7 +55,6 @@ def main() -> None:
6155
package_dir = temp_dir / "poptrie"
6256
if not package_dir.exists():
6357
raise SystemExit(f"poptrie package not found in {wheel.name}")
64-
6558
suffixes = (".so", ".pyd", ".dll", ".dylib")
6659
for ext_file in temp_dir.iterdir():
6760
if ext_file.is_file() and ext_file.name.startswith("poptrie") and ext_file.suffix in suffixes:
@@ -74,19 +67,8 @@ def main() -> None:
7467
(temp_dir / "setup.py").write_text(setup_py, encoding="utf-8")
7568

7669
wheel.unlink()
77-
python_tag, abi_tag, plat_tag = _parse_wheel_tags(wheel.name)
7870
subprocess.run(
79-
[
80-
sys.executable,
81-
"setup.py",
82-
"bdist_wheel",
83-
"--python-tag",
84-
python_tag,
85-
"--abi-tag",
86-
abi_tag,
87-
"--plat-name",
88-
plat_tag,
89-
],
71+
[sys.executable, "setup.py", "bdist_wheel"],
9072
cwd=temp_dir,
9173
check=True,
9274
)

0 commit comments

Comments
 (0)