Skip to content

Commit ae407e5

Browse files
committed
fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! Parse SDL headers from EMSDK during Pyodide builds
1 parent 9a922c6 commit ae407e5

File tree

2 files changed

+6
-12
lines changed

2 files changed

+6
-12
lines changed

build_sdl.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -262,12 +262,12 @@ def on_directive_handle(
262262
SDL_INCLUDE: Path
263263
if "PYODIDE" in os.environ:
264264
# None of the EMSDK environment variables exist! Search PATH for Emscripten as a workaround
265-
for path in os.environ["PATH"].split(os.pathsep):
265+
for path in os.environ["PATH"].split(os.pathsep)[::-1]:
266266
if Path(path).match("upstream/emscripten"):
267267
SDL_INCLUDE = Path(path)
268268
break
269269
else:
270-
raise AssertionError
270+
raise AssertionError(os.environ["PATH"])
271271
elif sys.platform == "win32" and SDL_PARSE_PATH is not None:
272272
SDL_INCLUDE = SDL_PARSE_PATH / "include"
273273
elif sys.platform == "darwin" and SDL_PARSE_PATH is not None:
@@ -392,11 +392,10 @@ def get_cdef() -> tuple[str, dict[str, str]]:
392392
extra_link_args += ["-rpath", "/usr/local/opt/llvm/lib/"]
393393

394394
# Use sdl-config to link to SDL on Linux.
395-
if sys.platform not in ["win32", "darwin"]:
395+
if sys.platform not in ["win32", "darwin"] and "PYODIDE" not in os.environ:
396396
extra_compile_args += (
397397
subprocess.check_output(["pkg-config", "sdl3", "--cflags"], universal_newlines=True).strip().split()
398398
)
399-
if "PYODIDE" not in os.environ:
400-
extra_link_args += (
401-
subprocess.check_output(["pkg-config", "sdl3", "--libs"], universal_newlines=True).strip().split()
402-
)
399+
extra_link_args += (
400+
subprocess.check_output(["pkg-config", "sdl3", "--libs"], universal_newlines=True).strip().split()
401+
)

setup.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,6 @@ def check_sdl_version() -> None:
7474
print("Did you forget to run 'git submodule update --init'?")
7575
sys.exit(1)
7676

77-
print(f"{os.environ.get('EMSDK')=}")
78-
print(f"{os.environ.get('EMSCRIPTEN')=}")
79-
print(f"{os.environ.get('EMSCRIPTEN_ROOT')=}")
80-
print(f"{os.environ.get('PYODIDE')=}")
81-
8277
check_sdl_version()
8378

8479
setup(

0 commit comments

Comments
 (0)