Skip to content

Commit 72a11d7

Browse files
committed
Rework logic for setting VERSIONINGIT_FOR_PACKAGE_INDEX
...to only do so for Python versions where it makes sense, rather than blanket enable it and conditionally remove it.
1 parent c159f82 commit 72a11d7

3 files changed

Lines changed: 24 additions & 33 deletions

File tree

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/env python
2+
3+
# Copyright (c) 2026, the cclib development team
4+
#
5+
# This file is part of cclib (http://cclib.github.io) and is distributed under
6+
# the terms of the BSD 3-Clause License.
7+
8+
# prepare_ci_for_versioningit.py: The sed command that updates the Open Babel
9+
# dependency in CI dirties the working copy, which would mess with the version
10+
# string in the build artifacts and cause problems when attempting to upload
11+
# to a package index. Disable this check since this workaround is not for the
12+
# Python version that saves build artifacts and uploads to package indices.
13+
14+
import os
15+
import sys
16+
17+
18+
minor_version = sys.version_info.minor
19+
if minor_version >= 10:
20+
with open(os.environ["GITHUB_ENV"], "a") as github_env_file:
21+
github_env_file.write("VERSIONINGIT_FOR_PACKAGE_INDEX=1\n")

.github/workflows/test_and_package.yml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,6 @@ concurrency:
1111
group: test-${{github.ref}}-${{github.event.pull_request.number || github.run_number}}
1212
cancel-in-progress: true
1313

14-
# For now always take the "reduced" form of the version, even for those
15-
# actions runs that do not push to a package index.
16-
env:
17-
VERSIONINGIT_FOR_PACKAGE_INDEX: true
18-
1914
jobs:
2015

2116
run-tests:
@@ -46,6 +41,9 @@ jobs:
4641
- name: Prepare conda environment
4742
run: |
4843
echo "/opt/conda/envs/cclib/bin" >> "${GITHUB_PATH}"
44+
- name: Prepare CI for Versioningit
45+
run: |
46+
python .github/scripts/prepare_ci_for_versioningit.py
4947
- name: Patch Open Babel dependency requirement
5048
run: |
5149
# The official Open Babel package doesn't provide wheels for Python
@@ -55,7 +53,6 @@ jobs:
5553
if: (matrix.container == 'shivupa/cclib-ci:py38-edge') || (matrix.container == 'shivupa/cclib-ci:py39-edge')
5654
- name: Install cclib
5755
run: |
58-
python tools/versioningit_conditional_disable.py
5956
python -m pip install -r requirements-bridges.txt
6057
python -m pip install '.[test]'
6158
- name: Filter code

tools/versioningit_conditional_disable.py

Lines changed: 0 additions & 27 deletions
This file was deleted.

0 commit comments

Comments
 (0)