|
3 | 3 |
|
4 | 4 | from __future__ import annotations |
5 | 5 |
|
6 | | -import os |
7 | 6 | import platform |
8 | | -import subprocess |
9 | 7 | import sys |
10 | 8 | from pathlib import Path |
11 | 9 |
|
@@ -37,43 +35,11 @@ def get_package_data() -> list[str]: |
37 | 35 | return files |
38 | 36 |
|
39 | 37 |
|
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 | | - |
70 | 38 | if not (SETUP_DIR / "libtcod/src").exists(): |
71 | 39 | print("Libtcod submodule is uninitialized.") |
72 | 40 | print("Did you forget to run 'git submodule update --init'?") |
73 | 41 | sys.exit(1) |
74 | 42 |
|
75 | | -check_sdl_version() |
76 | | - |
77 | 43 | setup( |
78 | 44 | py_modules=["libtcodpy"], |
79 | 45 | packages=["tcod", "tcod.sdl", "tcod.__pyinstaller"], |
|
0 commit comments