Files
ecoarkpywhl/README.md
root ea6a53bdc7
Some checks failed
EcoArk Wheel Pipeline CI / validate (push) Failing after 8m59s
ci: add Gitea Actions workflow for wheel pipeline validation
- .gitea/workflows/wheel-pipeline.yaml: checkout → env info → gen test
  wheels → pure repack test → native stub test → summary
- runs-on: ubuntu-latest (matches registered runner label)
- .gitignore: exclude generated test wheels
- README: add '通过 Gitea Actions 触发流水线' section
2026-05-13 11:53:17 +08:00

102 lines
3.1 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待后续完善。
## 通过 Gitea Actions 触发流水线
本仓库配置了 Gitea Actions 工作流commit 推送到 `main` 分支后会自动触发。
### 手动触发
1. 打开 Gitea 仓库页面 → **Actions** 标签
2.**EcoArk Wheel Pipeline CI** 工作流右侧点击 **▸ Run workflow**
3. 选择分支为 `main`,点击 **Run workflow**
### 工作流说明
| Job | 作用 |
|-----|------|
| `validate` | 生成测试 wheel分别验证纯 Python 轮子的重打包和 native 轮子的重编译入口 |
工作流文件位于 `.gitea/workflows/wheel-pipeline.yaml`,可直接扩展为生产流水线。
## 依赖
- Python ≥ 3.8(标准库,无需额外安装包)
- 对 native 包HarmonyOS 工具链(外部,不在本仓库内)
## 许可证
本项目许可证见仓库根目录。