feat: initial EcoArk HarmonyOS wheel pipeline skeleton
- wheel_pipeline.py: CLI entry point for repack/rebuild flow - pipeline/detect.py: detect pure vs native extension wheels - pipeline/repack.py: repack pure-Python wheels with harmonyos_arm64 tag - pipeline/rebuild.py: native wheel rebuild entry (stub for OHOS NDK) - pipeline/cli.py: argument parsing and orchestration - Makefile: convenience targets (repack, rebuild, clean) - README.md: documentation with usage and limitations - examples/gen_test_wheels.py: test wheel generator - output/: output directory for generated wheels
This commit is contained in:
30
pipeline/repack.py
Normal file
30
pipeline/repack.py
Normal file
@ -0,0 +1,30 @@
|
||||
import zipfile
|
||||
import os
|
||||
import shutil
|
||||
|
||||
|
||||
def repack_wheel(wheel_path: str, output_dir: str) -> str:
|
||||
basename = os.path.basename(wheel_path)
|
||||
name_parts = basename.split("-")
|
||||
|
||||
if len(name_parts) >= 4:
|
||||
wheel_name = "-".join(name_parts[:-3])
|
||||
version = name_parts[-3]
|
||||
pure_tag = f"{name_parts[-2]}-{name_parts[-1]}"
|
||||
else:
|
||||
wheel_name = name_parts[0]
|
||||
version = "0.0.0"
|
||||
pure_tag = "none-any"
|
||||
|
||||
harmony_tag = f"{wheel_name}-{version}-py3-none-harmonyos_arm64.whl"
|
||||
output_path = os.path.join(output_dir, harmony_tag)
|
||||
|
||||
os.makedirs(output_dir, exist_ok=True)
|
||||
|
||||
with zipfile.ZipFile(wheel_path, "r") as zin:
|
||||
with zipfile.ZipFile(output_path, "w", zipfile.ZIP_DEFLATED) as zout:
|
||||
for item in zin.infolist():
|
||||
data = zin.read(item.filename)
|
||||
zout.writestr(item, data)
|
||||
|
||||
return output_path
|
||||
Reference in New Issue
Block a user