Skip to content

Commit 622a8a9

Browse files
committed
Fix SDL setup in CI
Switch to custom composite action which fixes the issue Update build_sdl.py to handle SDL installed to the system path
1 parent 029ee45 commit 622a8a9

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

.github/workflows/python-package.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545
sdist:
4646
runs-on: ubuntu-latest
4747
steps:
48-
- uses: libsdl-org/setup-sdl@6574e20ac65ce362cd12f9c26b3a5e4d3cd31dee
48+
- uses: HexDecimal/my-setup-sdl-action@v1.0.0
4949
with:
5050
install-linux-dependencies: true
5151
build-type: "Debug"
@@ -125,7 +125,7 @@ jobs:
125125
run: |
126126
sudo apt-get update
127127
sudo apt-get install xvfb
128-
- uses: libsdl-org/setup-sdl@6574e20ac65ce362cd12f9c26b3a5e4d3cd31dee
128+
- uses: HexDecimal/my-setup-sdl-action@v1.0.0
129129
if: runner.os == 'Linux'
130130
with:
131131
install-linux-dependencies: true
@@ -168,7 +168,7 @@ jobs:
168168
needs: [ruff, mypy, sdist]
169169
runs-on: ubuntu-latest
170170
steps:
171-
- uses: libsdl-org/setup-sdl@6574e20ac65ce362cd12f9c26b3a5e4d3cd31dee
171+
- uses: HexDecimal/my-setup-sdl-action@v1.0.0
172172
if: runner.os == 'Linux'
173173
with:
174174
install-linux-dependencies: true
@@ -210,7 +210,7 @@ jobs:
210210
- name: Install Python dependencies
211211
run: |
212212
python -m pip install --upgrade pip tox
213-
- uses: libsdl-org/setup-sdl@6574e20ac65ce362cd12f9c26b3a5e4d3cd31dee
213+
- uses: HexDecimal/my-setup-sdl-action@v1.0.0
214214
if: runner.os == 'Linux'
215215
with:
216216
install-linux-dependencies: true
@@ -330,7 +330,7 @@ jobs:
330330
fetch-depth: ${{ env.git-depth }}
331331
- name: Checkout submodules
332332
run: git submodule update --init --recursive --depth 1
333-
- uses: libsdl-org/setup-sdl@6574e20ac65ce362cd12f9c26b3a5e4d3cd31dee
333+
- uses: HexDecimal/my-setup-sdl-action@v1.0.0
334334
with:
335335
install-linux-dependencies: true
336336
build-type: "Debug"

build_sdl.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,12 @@ def get_output(self) -> str:
212212
buffer.write(f"#define {name} ...\n")
213213
return buffer.getvalue()
214214

215+
def on_file_open(self, is_system_include: bool, includepath: str) -> Any: # noqa: ANN401, FBT001
216+
"""Ignore includes other than SDL headers."""
217+
if not Path(includepath).parent.name == "SDL3":
218+
raise FileNotFoundError
219+
return super().on_file_open(is_system_include, includepath)
220+
215221
def on_include_not_found(self, is_malformed: bool, is_system_include: bool, curdir: str, includepath: str) -> None: # noqa: ARG002, FBT001
216222
"""Remove bad includes such as stddef.h and stdarg.h."""
217223
assert "SDL3/SDL" not in includepath, (includepath, curdir)
@@ -283,7 +289,8 @@ def get_emscripten_include_dir() -> Path:
283289
r"-I(\S+)",
284290
subprocess.check_output(["pkg-config", "sdl3", "--cflags"], universal_newlines=True),
285291
)
286-
assert matches
292+
if not matches:
293+
matches = ["/usr/include"]
287294

288295
for match in matches:
289296
if Path(match, "SDL3/SDL.h").is_file():

0 commit comments

Comments
 (0)