From b15a5b70076ace52829d8684ece64b38702ad59d Mon Sep 17 00:00:00 2001 From: loathingKernel <142770+loathingKernel@users.noreply.github.com> Date: Thu, 18 Aug 2022 02:24:51 +0300 Subject: [PATCH] Fix game launching if compiled with Nuitka --- pyproject.toml | 10 ++++++++++ rare/__main__.py | 2 +- rare/utils/misc.py | 5 ++++- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 4628bb83..1e6c7a5f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -34,3 +34,13 @@ start = "rare.__main__:main" [build-system] requires = ["poetry-core>=1.0.0"] build-backend = "poetry.core.masonry.api" + +[build-system] +requires = ["setuptools>=42", "wheel", "nuitka", "toml"] +build-backend = "nuitka.distutils.Build" + +[nuitka] +show-scons = true +enable-plugin = pyqt5,anti-bloat +show-anti-bloat-changes = true +nofollow-import-to = ["*.tests", "*.distutils"] diff --git a/rare/__main__.py b/rare/__main__.py index 7b6663ea..c510ed8d 100644 --- a/rare/__main__.py +++ b/rare/__main__.py @@ -125,6 +125,6 @@ if __name__ == "__main__": # 0, os.path.join(pathlib.Path(__file__).parent.absolute(), "legendary") # ) # insert source directory - sys.path.insert(0, str(pathlib.Path(__file__).parents[1].absolute())) + #sys.path.insert(0, str(pathlib.Path(__file__).parents[1].absolute())) main() diff --git a/rare/utils/misc.py b/rare/utils/misc.py index 4dbe590e..a6826571 100644 --- a/rare/utils/misc.py +++ b/rare/utils/misc.py @@ -165,7 +165,10 @@ def get_size(b: Union[int, float]) -> str: def get_rare_executable() -> List[str]: - if platform.system() == "Linux" or platform.system() == "Darwin": + # lk: detech if nuitka + if "__compiled__" in globals(): + executable = [sys.executable] + elif platform.system() == "Linux" or platform.system() == "Darwin": # TODO flatpak if p := os.environ.get("APPIMAGE"): executable = [p]