Skip to content

Latest commit

 

History

History
188 lines (144 loc) · 3.96 KB

Build.md

File metadata and controls

188 lines (144 loc) · 3.96 KB

构建 IDLE-CN

项目结构

汉化修改都在 base 中进行,然后移植回各个发行版。

idcn_build
│
├── cpython  # 从 python/cpython 储存库中提取的 IDLE 部分
│   ├── idlelib
│   └── turtledemo
│
└── IDLE-CN  # IDLE-CN 项目
    ├── idcn  # 汉化模块
    │   ├── releases
    │   │   ├── 3.9  # IDLE 3.9 汉化发布版
    │   │   │   ├── idlelib
    │   │   │   └── turtledemo
    │   │   └── ...  # 更多版本
    │   └── __init__.py
    │
    ├── base  # 最新汉化版本,基于 cpython@main
    │   ├── idlelib
    │   └── turtledemo
    │
    ├── Tools
    │   ├── make_release.py  # 自动移植脚本
    │   └── release_versions.txt  # 3.9 ~ 3.13
    │
    └── setup.py  # 安装脚本

手动构建

  1. 请准备好 gitpython

    此外,还需安装 git filter-repo 用于从 cpython 中提取 IDLE 相关提交。

    pip install git-filter-repo
  2. 克隆 IDLE-CN。

    mkdir idcn_build
    cd idcn_build
    
    # 克隆 IDLE-CN
    git clone https://github.com/zetaloop/IDLE-CN.git
    cd IDLE-CN
    git submodule update --init --recursive
    cd ..
  3. 克隆 cpython 并提取 IDLE。

    git clone https://github.com/python/cpython.git
    cd cpython
    git filter-repo --path Lib/idlelib --path Lib/turtledemo --path-rename Lib/idlelib:idlelib --path-rename Lib/turtledemo:turtledemo --force
    cd ..
  4. 创建并应用补丁。

    python .\IDLE-CN\Tools\make_release.py
  5. 查看所有产生的 *.rej 冲突文件,手动解决补丁冲突。

  6. 打包与安装。

    本地安装:

    cd IDLE-CN
    pip install .
    cd ..

    打包上传至 PyPI:

    cd IDLE-CN
    python setup.py sdist bdist_wheel
    twine upload dist/*
    cd ..

Building IDLE-CN

Project structure

Changes are made in the base directory, then backported to each version.

idcn_build
│
├── cpython  # Extracted IDLE from python/cpython
│   ├── idlelib
│   └── turtledemo
│
└── IDLE-CN  # IDLE-CN Project
    ├── idcn  # Translator Module
    │   ├── releases
    │   │   ├── 3.9  # IDLE 3.9 zh-CN Release
    │   │   │   ├── idlelib
    │   │   │   └── turtledemo
    │   │   └── ...  # More versions
    │   └── __init__.py
    │
    ├── base  # Patched newest IDLE source, based on cpython@main
    │   ├── idlelib
    │   └── turtledemo
    │
    ├── Tools
    │   ├── make_release.py  # Patching script
    │   └── release_versions.txt  # 3.9~3.13
    │
    └── setup.py  # Installation script

Manual steps

  1. You need to have git and python installed.

    Additionally, install git filter-repo for extracting IDLE from cpython.

    pip install git-filter-repo
  2. Clone IDLE-CN.

    mkdir idcn_build
    cd idcn_build
    
    # Clone IDLE-CN
    git clone https://github.com/zetaloop/IDLE-CN.git
    cd IDLE-CN
    git submodule update --init --recursive
    cd ..
  3. Clone cpython and extract IDLE.

    git clone https://github.com/python/cpython.git
    cd cpython
    git filter-repo --path Lib/idlelib --path Lib/turtledemo --path-rename Lib/idlelib:idlelib --path-rename Lib/turtledemo:turtledemo --force
    cd ..
  4. Create and apply patches.

    python .\IDLE-CN\Tools\make_release.py
  5. Read all *.rej files and resolve conflicts manually.

  6. Package and install.

    Local install:

    cd IDLE-CN
    pip install .
    cd ..

    Package and upload to PyPI:

    cd IDLE-CN
    python setup.py sdist bdist_wheel
    twine upload dist/*
    cd ..