Skip to content

Commit ca81197

Browse files
committed
Upgrade to use SDL3 version of libtcod
1 parent de5d845 commit ca81197

File tree

12 files changed

+141
-131
lines changed

12 files changed

+141
-131
lines changed

.github/workflows/python-package.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
- name: APT update
4848
run: sudo apt-get update
4949
- name: Install APT dependencies
50-
run: sudo apt-get install libsdl2-dev
50+
run: sudo apt-get install libsdl3-dev
5151
- uses: actions/checkout@v4
5252
with:
5353
fetch-depth: ${{ env.git-depth }}
@@ -71,7 +71,7 @@ jobs:
7171
strategy:
7272
matrix:
7373
os: ["windows-latest", "macos-latest"]
74-
sdl-version: ["2.0.14", "2.0.16", "2.30.0"]
74+
sdl-version: ["3.2.10"]
7575
fail-fast: true
7676
steps:
7777
- uses: actions/checkout@v4
@@ -122,7 +122,7 @@ jobs:
122122
if: runner.os == 'Linux'
123123
run: |
124124
sudo apt-get update
125-
sudo apt-get install libsdl2-dev xvfb
125+
sudo apt-get install libsdl3-dev xvfb
126126
- name: Install Python dependencies
127127
run: |
128128
python -m pip install --upgrade pip
@@ -163,7 +163,7 @@ jobs:
163163
- name: Install APT dependencies
164164
run: |
165165
sudo apt-get update
166-
sudo apt-get install libsdl2-dev
166+
sudo apt-get install libsdl3-dev
167167
- uses: actions/checkout@v4
168168
with:
169169
fetch-depth: ${{ env.git-depth }}
@@ -204,7 +204,7 @@ jobs:
204204
if: runner.os == 'Linux'
205205
run: |
206206
sudo apt-get update
207-
sudo apt-get install libsdl2-dev
207+
sudo apt-get install libsdl3-dev
208208
- name: Run tox
209209
run: |
210210
tox -vv
@@ -248,7 +248,7 @@ jobs:
248248
CIBW_BEFORE_ALL_LINUX: >
249249
yum install -y epel-release &&
250250
yum-config-manager --enable epel &&
251-
yum install -y SDL2-devel
251+
yum install -y SDL3-devel
252252
CIBW_BEFORE_TEST: pip install numpy
253253
CIBW_TEST_COMMAND: python -c "import tcod.context"
254254
# Skip test on emulated architectures
@@ -287,7 +287,7 @@ jobs:
287287
- name: Install Python dependencies
288288
run: pip install -r requirements.txt
289289
- name: Prepare package
290-
# Downloads SDL2 for the later step.
290+
# Downloads SDL for the later step.
291291
run: python build_sdl.py
292292
- name: Build wheels
293293
uses: pypa/cibuildwheel@v2.19.2

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,10 @@ Release/
6969
tcod/_*.c
7070
tcod/_*.pyd
7171
.benchmarks
72-
dependencies/SDL2*
72+
dependencies/SDL*
7373
tcod/x86
7474
tcod/x64
75-
tcod/SDL2.framework
75+
tcod/SDL?.framework
7676
deb_dist/
7777
*.tar.gz
7878
tcod/version.py

.readthedocs.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
version: 2
66

77
build:
8-
os: ubuntu-22.04
8+
os: ubuntu-24.04
99
tools:
1010
python: "3.11"
1111
apt_packages:
12-
- libsdl2-dev
12+
- libsdl3-dev
1313

1414
submodules:
1515
include: all

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ For the most part it's just::
4848
==============
4949
* Python 3.8+
5050
* Windows, Linux, or MacOS X 10.9+.
51-
* On Linux, requires libsdl2 (2.0.10+).
51+
* On Linux, requires libsdl3 (3.2.0+).
5252

5353
===========
5454
Changelog

build_libtcod.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -207,11 +207,11 @@ def walk_sources(directory: str) -> Iterator[str]:
207207
for include in includes:
208208
try:
209209
ffi.cdef(include.header)
210-
except Exception:
210+
except Exception: # noqa: PERF203
211211
# Print the source, for debugging.
212212
print(f"Error with: {include.path}")
213213
for i, line in enumerate(include.header.split("\n"), 1):
214-
print("%03i %s" % (i, line))
214+
print(f"{i:03i} {line}")
215215
raise
216216
ffi.cdef(
217217
"""
@@ -220,7 +220,10 @@ def walk_sources(directory: str) -> Iterator[str]:
220220
)
221221
ffi.set_source(
222222
module_name,
223-
"#include <tcod/cffi.h>\n#include <SDL.h>",
223+
"""\
224+
#include <tcod/cffi.h>
225+
#define SDL_oldnames_h_
226+
#include <SDL3/SDL.h>""",
224227
include_dirs=include_dirs,
225228
library_dirs=library_dirs,
226229
sources=sources,

0 commit comments

Comments
 (0)