Skip to content

Commit a395878

Browse files
committed
Remove redundant SDL version check from setup.py
This duplicates build_sdl.py and maybe isn't as useful as it used to be. I could import from that module if I really need the check in setup.py.
1 parent 6d2b2c7 commit a395878

File tree

1 file changed

+0
-36
lines changed

1 file changed

+0
-36
lines changed

setup.py

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,14 @@
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

1210
from setuptools import setup
1311

1412
# ruff: noqa: T201
1513

16-
SDL_VERSION_NEEDED = (3, 2, 0)
17-
1814
SETUP_DIR = Path(__file__).parent # setup.py current directory
1915

2016

@@ -37,43 +33,11 @@ def get_package_data() -> list[str]:
3733
return files
3834

3935

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

75-
check_sdl_version()
76-
7741
setup(
7842
py_modules=["libtcodpy"],
7943
packages=["tcod", "tcod.sdl", "tcod.__pyinstaller"],

0 commit comments

Comments
 (0)