Skip to content

Fix VERSION env var collision in PyPI builds, Docker passthrough, and no-tag fallback divergence#1068

Merged
frankslin merged 5 commits intomasterfrom
copilot/implement-unified-versioning-mechanism
Mar 27, 2026
Merged

Fix VERSION env var collision in PyPI builds, Docker passthrough, and no-tag fallback divergence#1068
frankslin merged 5 commits intomasterfrom
copilot/implement-unified-versioning-mechanism

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 27, 2026

The unified versioning mechanism introduced three bugs: (1) release scripts use VERSION as a loop variable, clobbering the package version env var so wheels get stamped with Python versions like 3.14, (2) Linux Docker builds never receive the computed VERSION, and since the hardcoded OPENCC_VERSION_* constants were removed from CMakeLists.txt, setup.py's fallback silently produces 1.0.0, (3) the no-tag fallback disagrees between compute-version.sh (g<sha>) and GitVersion.cmake (1.2.1+g<sha>).

Loop variable collision

  • Rename VERSIONPYVER in release-pypi-linux.sh and release-pypi-macos.sh
-for VERSION in 3.9 3.10 3.11 3.12 3.13 3.14; do
-    conda create -y -n py$VERSION python=$VERSION
+for PYVER in 3.9 3.10 3.11 3.12 3.13 3.14; do
+    conda create -y -n py$PYVER python=$PYVER

Docker VERSION passthrough

  • Add -e VERSION=${VERSION} to docker run in release-pypi.yml and python.yml

No-tag fallback alignment

  • Add FALLBACK_VERSION="1.2.1" to compute-version.sh (matching cmake/GitVersion.cmake) so the no-tag case outputs v1.2.1+g<sha> instead of bare g<sha>

Copilot AI and others added 4 commits March 25, 2026 15:28
- Add scripts/compute-version.sh for Git-based version derivation
- Add cmake/GitVersion.cmake module to replace hardcoded CMake version
- Update CMakeLists.txt to use GitVersion module with fallback
- Update all CI workflows with fetch-depth: 0 and version computation
- Update artifact names to include VERSION in all workflows
- Update setup.py to prefer VERSION env var for Python package version

Co-authored-by: frankslin <748873+frankslin@users.noreply.github.com>
Agent-Logs-Url: https://github.com/BYVoid/OpenCC/sessions/f2246182-75cf-48a2-99e4-a22a9da2ad97
…ivergence

- Rename VERSION→PYVER loop variable in release-pypi-linux.sh and
  release-pypi-macos.sh to avoid overwriting the package version env var
- Pass -e VERSION=${VERSION} into Docker containers in release-pypi.yml
  and python.yml so the computed version reaches setup.py
- Align no-tag fallback in compute-version.sh with cmake/GitVersion.cmake
  to output v1.2.1+g<sha> instead of bare g<sha>

Agent-Logs-Url: https://github.com/BYVoid/OpenCC/sessions/bdd95762-bf18-4b99-b239-6fbc9017796d

Co-authored-by: frankslin <748873+frankslin@users.noreply.github.com>
@frankslin frankslin merged commit dd51fb7 into master Mar 27, 2026
31 of 32 checks passed
@frankslin frankslin deleted the copilot/implement-unified-versioning-mechanism branch March 27, 2026 01:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants