f9d9f8ec07439321805f0258ff196a320ecedb29
EcoArk HarmonyOS Wheel Pipeline
为 EcoArk / HarmonyOS Python 环境 准备的 wheel 重打包与重编译流水线。
用途
- 接收一个
.whl文件作为输入 - 自动检测是 纯 Python wheel 还是 含 native 扩展的 wheel
- 纯 Python wheel → 直接重打包为
harmonyos_arm64兼容标签,安装即用 - Native wheel → 预留 HarmonyOS/arm64 交叉编译入口(当前为骨架,可扩展)
目录结构
ecoarkpywhl/
├── wheel_pipeline.py # CLI 入口(最简调用)
├── pipeline/
│ ├── cli.py # 参数解析 & 主流程
│ ├── detect.py # 检测 wheel 类型(纯 Python / native)
│ ├── repack.py # 纯 Python wheel 重打包
│ └── rebuild.py # Native wheel 重编译入口(骨架)
├── Makefile # 常用命令
├── output/ # 输出目录(生成文件放这里)
└── README.md
快速开始
# 纯 Python wheel → 重打包
python3 wheel_pipeline.py some_pure_package.whl
# 指定输出目录
python3 wheel_pipeline.py some_pure_package.whl --output-dir /tmp/wheels
# Native wheel → 触发重编译入口(当前只复制 + 写 stub)
python3 wheel_pipeline.py some_native_package.whl
或通过 Makefile:
make repack INPUT=some_package.whl
make rebuild INPUT=some_native_package.whl
限制
| 场景 | 状态 |
|---|---|
| 纯 Python wheel → 重打包安装 | ✅ 支持 |
| Pure Python → 重新打 tag | ✅ 支持 |
| Native wheel → HarmonyOS 重编译 | 🚧 预留入口,需接入 OHOS NDK 工具链 |
| 依赖复杂的 native 包(numpy/scipy 等) | 🚧 需要对应依赖也移植到 HarmonyOS |
纯 Python wheel
纯 Python wheel(文件名中包含 py3-none-any 等标签,且不含 .so/.pyd 文件)可以直接重打包为 harmonyos_arm64 标签,在 HarmonyOS Python 环境中安装运行。
python3 wheel_pipeline.py mypackage.whl -o output/
# → output/mypackage-1.0.0-py3-none-harmonyos_arm64.whl
Native wheel
含 C/C++/Rust 等 native 扩展的 wheel 需要:
- HarmonyOS SDK / OHOS NDK
- 对应架构(arm64)的交叉编译工具链
- Python 头文件与目标 Python 版本匹配
- 所有 C 依赖也已移植到 HarmonyOS
当前版本仅输出 stub,待后续完善。
依赖
- Python ≥ 3.8(标准库,无需额外安装包)
- 对 native 包:HarmonyOS 工具链(外部,不在本仓库内)
许可证
本项目许可证见仓库根目录。
Description
Languages
Python
95%
Makefile
5%