From b3edd804552e72d8960439a7942e183fc5a24768 Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Sat, 28 Sep 2024 21:58:14 +0200 Subject: [PATCH] Migrate most of the project to pyproject.toml --- pyproject.toml | 46 ++++++++++++++++++++++++++++++++++++++++++++++ setup.py | 50 ++++++++++---------------------------------------- 2 files changed, 56 insertions(+), 40 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 1fa2ff88..4cc74e01 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,49 @@ +[build-system] +requires = ["setuptools>=60", "wheel"] +build-backend = "setuptools.build_meta" + +[project] +name = "sccontroller" +version = "0.4.9.3" # Replace with DAEMON_VERSION or vice versa? +description = "User-mode driver, mapper and GTK3 based GUI for Steam Controller, DS4 and similar controllers." +authors = [{name = "C0rn3j", email = "martin@rys.rs"}] +license = {text = "GPL-2.0-only"} +keywords = ["controller", "mapping", "tools"] +classifiers = [ + "Programming Language :: Python :: 3", + "License :: OSI Approved :: GNU General Public License v2 (GPLv2)", + "Operating System :: POSIX :: Linux" +] +requires-python = ">=3.8" +#platforms = ["Linux"] + +[tool.setuptools] +packages = [ + "scc", + "scc.drivers", + "scc.lib", + "scc.x11", + "scc.osd", + "scc.foreign", + "scc.gui", + "scc.gui.ae", + "scc.gui.importexport", + "scc.gui.creg" +] + +# https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#creating-executable-scripts +[project.scripts] +scc-daemon = "scripts.scc_daemon" +sc-controller = "scripts.sc_controller" +scc = "scripts.scc" +scc-osd-dialog = "scripts.scc_osd_dialog" +scc-osd-keyboard = "scripts.scc_osd_keyboard" +scc-osd-launcher = "scripts.scc_osd_launcher" +scc-osd-menu = "scripts.scc_osd_menu" +scc-osd-message = "scripts.scc_osd_message" +scc-osd-radial-menu = "scripts.scc_osd_radial_menu" +scc-osd-show-bindings = "scripts.scc_osd_show_bindings" + [tool.ruff] # Target non-EOL releases at minimum, or later if needed # https://devguide.python.org/versions/ diff --git a/setup.py b/setup.py index 46bfab4f..5cfa416f 100755 --- a/setup.py +++ b/setup.py @@ -3,8 +3,6 @@ from setuptools import Extension, setup -from scc.constants import DAEMON_VERSION - data_files = [ ("share/scc/glade", glob.glob("glade/*.glade")), ("share/scc/glade/ae", glob.glob("glade/ae/*.glade")), @@ -35,43 +33,15 @@ ) for x in glob.glob("images/menu-icons/*") ] - -packages = [ - # Required - "scc", "scc.drivers", "scc.lib", - # Useful - "scc.x11", "scc.osd", "scc.foreign", - # GUI - "scc.gui", "scc.gui.ae", "scc.gui.importexport", "scc.gui.creg", +extensions = [ + Extension("libuinput", sources=["scc/uinput.c"]), + Extension("libcemuhook", define_macros=[("PYTHON", "1")], sources=["scc/cemuhook_server.c"], libraries=["z"]), + Extension("libhiddrv", sources=["scc/drivers/hiddrv.c"]), + Extension("libsc_by_bt", sources=["scc/drivers/sc_by_bt.c"]), + Extension("libremotepad", sources=["scc/drivers/remotepad_controller.c"]), ] -if __name__ == "__main__": - setup(name = "sccontroller", - version = DAEMON_VERSION, - description = "Standalone controller maping tool", - author = "C0rn3j", - packages = packages, - data_files = data_files, - scripts = [ - "scripts/scc-daemon", - "scripts/sc-controller", - "scripts/scc", - "scripts/scc-osd-dialog", - "scripts/scc-osd-keyboard", - "scripts/scc-osd-launcher", - "scripts/scc-osd-menu", - "scripts/scc-osd-message", - "scripts/scc-osd-radial-menu", - "scripts/scc-osd-show-bindings", - ], - license = "GPL-2.0-only", - platforms = ["Linux"], - ext_modules = [ - Extension("libuinput", sources = ["scc/uinput.c"]), - Extension("libcemuhook", define_macros = [("PYTHON", 1)], - sources = ["scc/cemuhook_server.c"], libraries = ["z"]), - Extension("libhiddrv", sources = ["scc/drivers/hiddrv.c"]), - Extension("libsc_by_bt", sources = ["scc/drivers/sc_by_bt.c"]), - Extension("libremotepad", sources = ["scc/drivers/remotepad_controller.c"]), - ], - ) +setup( + ext_modules=extensions, + data_files = data_files, +)