Repository navigation
Expand file tree
/
Copy pathsetup.py
More file actions
executable file
·63 lines (57 loc) · 2.77 KB
/
Copy pathsetup.py
File metadata and controls
executable file
·63 lines (57 loc) · 2.77 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
59
60
61
62
63
#!/usr/bin/env python3
"""Installation script for everything that could not be migrated to pyproject.toml so far."""
import glob
import runpy
import sys
from pathlib import Path
from setuptools import Extension, setup
# Compile translations
# TODO(Martin): Probably move this under scc/ and define within pyproject.toml
ROOT = Path(__file__).resolve().parent
runpy.run_path(str(ROOT / "tools/translations_compile.py"))["main"]()
data_files = [
("share/scc/ui", glob.glob("ui/*.ui")),
("share/scc/ui/ae", glob.glob("ui/ae/*.ui")),
("share/scc/images", glob.glob("images/*.svg")),
("share/scc/images", glob.glob("images/*.json")),
("share/scc/images/button-images", glob.glob("images/button-images/*.svg")),
("share/scc/images/button-images", glob.glob("images/button-images/*.json")),
("share/scc/images/controller-icons", glob.glob("images/controller-icons/*.svg")),
("share/scc/images/controller-images", glob.glob("images/controller-images/*.svg")),
("share/icons/hicolor/24x24/status", glob.glob("images/24x24/status/*.png")),
("share/icons/hicolor/256x256/status", glob.glob("images/256x256/status/*.png")),
("share/icons/hicolor/scalable/apps", ["packaging/io.github.c0rn3j.sc-controller.svg"]),
("share/scc/default_profiles", glob.glob("default_profiles/*.sccprofile")),
("share/scc/default_profiles", glob.glob("default_profiles/.*.sccprofile")),
("share/scc/default_menus", glob.glob("default_menus/*.menu")),
("share/scc/default_menus", glob.glob("default_menus/.*.menu")),
("share/scc/osd-styles", glob.glob("osd-styles/*.json")),
("share/scc/osd-styles", glob.glob("osd-styles/*.css")),
("share/scc/", ["gamecontrollerdb.txt"]),
("share/metainfo", ["packaging/io.github.c0rn3j.sc-controller.metainfo.xml"]),
("share/mime/packages", ["packaging/io.github.c0rn3j.sc-controller.mimetypes.xml"]),
("share/applications", ["packaging/io.github.c0rn3j.sc-controller.desktop"]),
("lib/udev/rules.d", glob.glob("packaging/*.rules")),
] + [ # menu icons subfolders
("share/scc/images/menu-icons/" + x.split("/")[-1], [x + "/LICENSES"] + glob.glob(x + "/*.png"))
for x in glob.glob("images/menu-icons/*")
] + [
(f"share/locale/{path.parent.parent.name}/LC_MESSAGES", [str(path)])
for path in Path("scc/locale").glob("*/LC_MESSAGES/*.mo")
]
extensions = [
Extension("libsc_by_bt", sources=["scc/drivers/sc_by_bt.c"]),
Extension("libremotepad", sources=["scc/drivers/remotepad_controller.c"]),
]
if sys.platform == "linux":
extensions.append(Extension("libhiddrv", sources=["scc/drivers/linux/hiddrv.c"]))
extensions.extend([
Extension("libuinput", sources=["scc/uinput.c"]),
# TODO(Martin): Get this working on Windows
Extension( "libcemuhook", sources=["scc/cemuhook_server.c"], libraries=["z"], define_macros=[("PYTHON", "1")],
),
])
setup(
ext_modules=extensions,
data_files=data_files,
)