Skip to content

Commit a7f6017

Browse files
committed
Update GA release
1 parent 56658b4 commit a7f6017

3 files changed

Lines changed: 94 additions & 55 deletions

File tree

.github/workflows/release.yml

Lines changed: 5 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -16,75 +16,23 @@ jobs:
1616
matrix:
1717
include:
1818
# Linux 64 bit manylinux2014
19-
- os: ubuntu-latest
20-
python: '3.10'
21-
cp: '310'
22-
platform_id: manylinux_x86_64
23-
manylinux_image: manylinux2014
24-
- os: ubuntu-latest
25-
python: '3.11'
26-
cp: '311'
27-
platform_id: manylinux_x86_64
28-
manylinux_image: manylinux2014
2919
- os: ubuntu-latest
3020
python: '3.12'
3121
cp: '312'
3222
platform_id: manylinux_x86_64
3323
manylinux_image: manylinux2014
34-
- os: ubuntu-latest
35-
python: '3.13'
36-
cp: '313'
37-
platform_id: manylinux_x86_64
38-
manylinux_image: manylinux2014
39-
- os: ubuntu-latest
40-
python: '3.14'
41-
cp: '314'
42-
platform_id: manylinux_x86_64
43-
manylinux_image: manylinux2014
4424

45-
# MacOS x86_64
46-
- os: macos-latest-large
47-
python: '3.10'
48-
cp: '310'
49-
platform_id: macosx_x86_64
50-
- os: macos-latest-large
51-
python: '3.11'
52-
cp: '311'
53-
platform_id: macosx_x86_64
25+
# MacOS x86_64
5426
- os: macos-latest-large
5527
python: '3.12'
5628
cp: '312'
5729
platform_id: macosx_x86_64
58-
- os: macos-latest-large
59-
python: '3.13'
60-
cp: '313'
61-
platform_id: macosx_x86_64
62-
- os: macos-latest-large
63-
python: '3.14'
64-
cp: '314'
65-
platform_id: macosx_x86_64
6630

6731
# MacOS arm64
68-
- os: macos-latest
69-
python: '3.10'
70-
cp: '310'
71-
platform_id: macosx_arm64
72-
- os: macos-latest
73-
python: '3.11'
74-
cp: '311'
75-
platform_id: macosx_arm64
7632
- os: macos-latest
7733
python: '3.12'
7834
cp: '312'
7935
platform_id: macosx_arm64
80-
- os: macos-latest
81-
python: '3.13'
82-
cp: '313'
83-
platform_id: macosx_arm64
84-
- os: macos-latest
85-
python: '3.14'
86-
cp: '314'
87-
platform_id: macosx_arm64
8836

8937
steps:
9038
- name: Checkout TextWorld
@@ -94,10 +42,12 @@ jobs:
9442
uses: pypa/cibuildwheel@v2.22.0
9543
env:
9644
CIBW_BUILD: cp${{ matrix.cp }}-${{ matrix.platform_id }}
97-
CIBW_ARCHS: all
45+
CIBW_ARCHS: native # avoid building extra archs unintentionally
9846
CIBW_MANYLINUX_X86_64_IMAGE: ${{ matrix.manylinux_image }}
99-
CIBW_MANYLINUX_I686_IMAGE: ${{ matrix.manylinux_image }}
10047
CIBW_BUILD_VERBOSITY: 1
48+
49+
# Retag to py3-none-<platform>
50+
CIBW_REPAIR_WHEEL_COMMAND: "python tools/retag_wheel_py3-none.py {wheel}"
10151
with:
10252
output-dir: wheelhouse
10353

setup.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,16 @@
1111
from setuptools.command.develop import develop
1212
from setuptools.command.install import install
1313
from setuptools.command.build_py import build_py
14+
from setuptools.dist import Distribution
15+
16+
17+
class BinaryDistribution(Distribution):
18+
"""
19+
Force wheel to be marked as non-pure (platform-specific) even though we
20+
don't compile extension modules, because we bundle OS-specific binaries.
21+
"""
22+
def has_ext_modules(self):
23+
return True
1424

1525

1626
def _pre_install(dir):
@@ -41,6 +51,7 @@ def run(self):
4151
setup(
4252
name='textworld',
4353
version=open(os.path.join("textworld", "version.py")).readlines()[0].split("=")[-1].strip("' \n"),
54+
distclass=BinaryDistribution,
4455
cmdclass={
4556
'build_py': CustomBuildPy,
4657
'install': CustomInstall,

tools/retag_wheel_p3-none.py

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
"""
2+
Rewrite wheel tags from cp312-cp312-PLATFORM to py3-none-PLATFORM.
3+
4+
This is appropriate when the wheel contains OS-specific non-Python binaries
5+
(e.g., Inform7) but no Python extension modules (ABI-independent).
6+
"""
7+
8+
import argparse
9+
import os
10+
import re
11+
import zipfile
12+
from pathlib import Path
13+
14+
15+
WHEEL_TAG_RE = re.compile(r"^Tag:\s*(\S+)\s*$")
16+
17+
18+
def parse_platform_tag(filename: str) -> str:
19+
# {dist}-{ver}-{python tag}-{abi tag}-{platform tag}.whl
20+
m = re.match(r"^.+-[^-]+-[^-]+-(?P<plat>.+)\.whl$", filename)
21+
if not m:
22+
raise ValueError(f"Cannot parse wheel filename: {filename}")
23+
return m.group("plat")
24+
25+
26+
def retag(path: Path) -> Path:
27+
plat = parse_platform_tag(path.name)
28+
new_name = re.sub(r"-[^-]+-[^-]+-" + re.escape(plat) + r"\.whl$", f"-py3-none-{plat}.whl", path.name)
29+
# If the regex didn't match (unexpected format), fall back to explicit construction:
30+
if new_name == path.name:
31+
# Use a more explicit split
32+
parts = path.name[:-4].split("-")
33+
if len(parts) < 5:
34+
raise ValueError(f"Unexpected wheel name: {path.name}")
35+
new_name = "-".join(parts[:-3] + ["py3", "none", parts[-1]]) + ".whl"
36+
37+
out = path.with_name(new_name)
38+
39+
with zipfile.ZipFile(path, "r") as zin, zipfile.ZipFile(out, "w", compression=zipfile.ZIP_DEFLATED) as zout:
40+
wheel_files = [n for n in zin.namelist() if n.endswith(".dist-info/WHEEL")]
41+
if len(wheel_files) != 1:
42+
raise RuntimeError(f"Expected exactly one .dist-info/WHEEL, found: {wheel_files}")
43+
wheel_meta = wheel_files[0]
44+
45+
for info in zin.infolist():
46+
data = zin.read(info.filename)
47+
if info.filename == wheel_meta:
48+
text = data.decode("utf-8")
49+
lines = text.splitlines(True)
50+
51+
kept = []
52+
for line in lines:
53+
if WHEEL_TAG_RE.match(line.strip()):
54+
continue
55+
kept.append(line)
56+
57+
kept.append(f"Tag: py3-none-{plat}\n")
58+
data = "".join(kept).encode("utf-8")
59+
60+
zout.writestr(info, data)
61+
62+
# Remove original so only retagged wheel remains
63+
os.remove(path)
64+
return out
65+
66+
67+
def main() -> None:
68+
ap = argparse.ArgumentParser()
69+
ap.add_argument("wheel", nargs="+")
70+
args = ap.parse_args()
71+
72+
for w in args.wheel:
73+
out = retag(Path(w))
74+
print(f"Retagged: {w} -> {out.name}")
75+
76+
77+
if __name__ == "__main__":
78+
main()

0 commit comments

Comments
 (0)