-
-
Notifications
You must be signed in to change notification settings - Fork 42
Expand file tree
/
Copy pathsetup.py
More file actions
executable file
·58 lines (46 loc) · 1.43 KB
/
setup.py
File metadata and controls
executable file
·58 lines (46 loc) · 1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/usr/bin/env python
"""Python-tcod setup script."""
from __future__ import annotations
import sys
from pathlib import Path
from setuptools import setup
# ruff: noqa: T201
SDL_VERSION_NEEDED = (3, 2, 0)
SETUP_DIR = Path(__file__).parent # setup.py current directory
def get_package_data() -> list[str]:
"""Get data files which will be included in the main tcod/ directory."""
files = [
"py.typed",
"lib/LIBTCOD-CREDITS.txt",
"lib/LIBTCOD-LICENSE.txt",
"lib/README-SDL.txt",
]
if sys.platform == "win32":
if "ARM64" in sys.version:
files += ["arm64/SDL3.dll"]
elif "AMD64" in sys.version:
files += ["x64/SDL3.dll"]
else:
files += ["x86/SDL3.dll"]
if sys.platform == "darwin":
files += ["SDL3.framework/Versions/A/SDL3"]
return files
if not (SETUP_DIR / "libtcod/src").exists():
print("Libtcod submodule is uninitialized.")
print("Did you forget to run 'git submodule update --init'?")
sys.exit(1)
options = {
"bdist_wheel": {
"py_limited_api": "cp310",
}
}
if "free-threading build" in sys.version:
del options["bdist_wheel"]["py_limited_api"]
setup(
py_modules=["libtcodpy"],
packages=["tcod", "tcod.sdl", "tcod.__pyinstaller"],
package_data={"tcod": get_package_data()},
cffi_modules=["build_libtcod.py:ffi"],
platforms=["Windows", "MacOS", "Linux"],
options=options,
)