Files
ecoarkpywhl/README.md
root 8d9a757ef5 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
2026-05-13 11:36:13 +08:00

84 lines
2.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 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
```
## 快速开始
```bash
# 纯 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:
```bash
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 环境中安装运行。
```bash
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 需要:
1. HarmonyOS SDK / OHOS NDK
2. 对应架构(arm64)的交叉编译工具链
3. Python 头文件与目标 Python 版本匹配
4. 所有 C 依赖也已移植到 HarmonyOS
当前版本仅输出 stub,待后续完善。
## 依赖
- Python ≥ 3.8(标准库,无需额外安装包)
- 对 native 包:HarmonyOS 工具链(外部,不在本仓库内)
## 许可证
本项目许可证见仓库根目录。