Skip to content

Commit a4681b3

Browse files
committed
fixup! fixup! Parse SDL headers from EMSDK during Pyodide builds
1 parent 115bee2 commit a4681b3

File tree

2 files changed

+2
-36
lines changed

2 files changed

+2
-36
lines changed

build_sdl.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,8 @@ def check_sdl_version() -> None:
129129
"""Check the local SDL3 version on Linux distributions."""
130130
if not sys.platform.startswith("linux"):
131131
return
132+
if "PYODIDE" in os.environ:
133+
return
132134
needed_version = f"{SDL_MIN_VERSION[0]}.{SDL_MIN_VERSION[1]}.{SDL_MIN_VERSION[2]}"
133135
try:
134136
sdl_version_str = subprocess.check_output(

setup.py

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@
33

44
from __future__ import annotations
55

6-
import os
76
import platform
8-
import subprocess
97
import sys
108
from pathlib import Path
119

@@ -37,45 +35,11 @@ def get_package_data() -> list[str]:
3735
return files
3836

3937

40-
def check_sdl_version() -> None:
41-
"""Check the local SDL version on Linux distributions."""
42-
if not sys.platform.startswith("linux"):
43-
return
44-
if "PYODIDE" in os.environ:
45-
return
46-
needed_version = "{}.{}.{}".format(*SDL_VERSION_NEEDED)
47-
try:
48-
sdl_version_str = subprocess.check_output(
49-
["pkg-config", "sdl3", "--modversion"], # noqa: S607
50-
universal_newlines=True,
51-
).strip()
52-
except FileNotFoundError:
53-
try:
54-
sdl_version_str = subprocess.check_output(["sdl3-config", "--version"], universal_newlines=True).strip() # noqa: S607
55-
except FileNotFoundError as exc:
56-
msg = (
57-
f"libsdl3-dev or equivalent must be installed on your system and must be at least version {needed_version}."
58-
"\nsdl3-config must be on PATH."
59-
)
60-
raise RuntimeError(msg) from exc
61-
except subprocess.CalledProcessError as exc:
62-
if sys.version_info >= (3, 11):
63-
exc.add_note(f"Note: {os.environ.get('PKG_CONFIG_PATH')=}")
64-
raise
65-
print(f"Found SDL {sdl_version_str}.")
66-
sdl_version = tuple(int(s) for s in sdl_version_str.split("."))
67-
if sdl_version < SDL_VERSION_NEEDED:
68-
msg = f"SDL version must be at least {needed_version}, (found {sdl_version_str})"
69-
raise RuntimeError(msg)
70-
71-
7238
if not (SETUP_DIR / "libtcod/src").exists():
7339
print("Libtcod submodule is uninitialized.")
7440
print("Did you forget to run 'git submodule update --init'?")
7541
sys.exit(1)
7642

77-
check_sdl_version()
78-
7943
setup(
8044
py_modules=["libtcodpy"],
8145
packages=["tcod", "tcod.sdl", "tcod.__pyinstaller"],

0 commit comments

Comments
 (0)