Skip to content

Commit 69d9955

Browse files
committed
Fix testpypi build
1 parent f3a6b71 commit 69d9955

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

.github/workflows/publish-to-testpypi.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ jobs:
2222
- name: Install pypa/build
2323
run: python3 -m pip install --user build
2424

25+
- name: Add commit to version
26+
run: sed -i -e 's/__version__\s*=\s*"(.+)"/__version__ = "\1+$(git rev-parse --short HEAD)"/' pathspec/_version.py
27+
28+
- name: Prebuild
29+
run: python3 prebuild.py
30+
2531
- name: Build a binary wheel and a source tarball
2632
run: python3 -m build
2733

prebuild.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@
99
import sys
1010
from pathlib import (
1111
Path)
12-
13-
import tomli
12+
try:
13+
import tomllib # Added in 3.11.
14+
except ModuleNotFoundError:
15+
import tomli as tomllib
1416

1517
CHANGES_0_IN_RST = Path("CHANGES_0.in.rst")
1618
CHANGES_1_IN_RST = Path("CHANGES_1.in.rst")
@@ -95,7 +97,7 @@ def generate_setup_cfg() -> None:
9597
"""
9698
print(f"Read: {PYPROJECT_TOML}")
9799
with PYPROJECT_TOML.open('rb') as fh:
98-
config = tomli.load(fh)
100+
config = tomllib.load(fh)
99101

100102
print(f"Write: {SETUP_CFG}")
101103
output = configparser.ConfigParser()

0 commit comments

Comments
 (0)