Skip to content

Commit 948786e

Browse files
committed
fixup! fixup! fixup! fixup! fixup! squash! fixup! Fix CI regressions
1 parent d50a86e commit 948786e

File tree

3 files changed

+20
-4
lines changed

3 files changed

+20
-4
lines changed

.github/workflows/python-package.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,10 @@ jobs:
265265
systemd-devel mesa-libGL-devel libxkbcommon-devel mesa-libGLES-devel \
266266
mesa-libEGL-devel vulkan-devel wayland-devel wayland-protocols-devel \
267267
libdrm-devel mesa-libgbm-devel libusb-devel
268+
git clone https://github.com/libsdl-org/SDL.git sdl_repo
269+
cmake -S sdl_repo -B sdl_build
270+
cmake --build sdl_build --config Release
271+
cmake --install sdl_build --config Release
268272
CIBW_BEFORE_TEST: pip install numpy
269273
CIBW_TEST_COMMAND: python -c "import tcod.context"
270274
# Skip test on emulated architectures

build_libtcod.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,12 @@ def walk_sources(directory: str) -> Iterator[str]:
211211

212212
ffi = FFI()
213213
sdl_cdef, sdl_strings = build_sdl.get_cdef()
214-
ffi.cdef(sdl_cdef)
214+
try:
215+
ffi.cdef(sdl_cdef)
216+
except Exception as exc:
217+
if sys.version_info >= (3, 11):
218+
exc.add_note(f"Processed cdef is as follows:\n{sdl_cdef}")
219+
raise
215220
for include in includes:
216221
try:
217222
ffi.cdef(include.header)

build_sdl.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from __future__ import annotations
55

66
import io
7+
import logging
78
import os
89
import platform
910
import re
@@ -21,6 +22,12 @@
2122
# This script calls a lot of programs.
2223
# ruff: noqa: S603, S607, T201
2324

25+
# Ignore f-strings in logging, these will eventually be replaced with t-strings.
26+
# ruff: noqa: G004
27+
28+
logger = logging.getLogger(__name__)
29+
30+
2431
BIT_SIZE, LINKAGE = platform.architecture()
2532

2633
# Reject versions of SDL older than this, update the requirements in the readme if you change this.
@@ -133,7 +140,7 @@ def check_sdl_version() -> None:
133140
f" {needed_version}.\nsdl3-config must be on PATH."
134141
)
135142
raise RuntimeError(msg) from exc
136-
print(f"Found SDL {sdl_version_str}.")
143+
logger.info(f"Found SDL {sdl_version_str}.")
137144
sdl_version = tuple(int(s) for s in sdl_version_str.split("."))
138145
if sdl_version < SDL_MIN_VERSION:
139146
msg = f"SDL version must be at least {needed_version}, (found {sdl_version_str})"
@@ -150,7 +157,7 @@ def get_sdl_file(version: str) -> Path:
150157
sdl_local_file = Path("dependencies", sdl_archive)
151158
sdl_remote_url = f"https://www.libsdl.org/release/{sdl_archive}"
152159
if not sdl_local_file.exists():
153-
print(f"Downloading {sdl_remote_url}")
160+
logger.info(f"Downloading {sdl_remote_url}")
154161
Path("dependencies/").mkdir(parents=True, exist_ok=True)
155162
with requests.get(sdl_remote_url) as response: # noqa: S113
156163
response.raise_for_status()
@@ -167,7 +174,7 @@ def unpack_sdl(version: str) -> Path:
167174
if sdl_path.exists():
168175
return sdl_path
169176
sdl_archive = get_sdl_file(version)
170-
print(f"Extracting {sdl_archive}")
177+
logger.info(f"Extracting {sdl_archive}")
171178
if sdl_archive.suffix == ".zip":
172179
with zipfile.ZipFile(sdl_archive) as zf:
173180
zf.extractall("dependencies/")

0 commit comments

Comments
 (0)