diff --git a/scripts/compile.sh b/scripts/compile.sh index 2486e46..4897e74 100644 --- a/scripts/compile.sh +++ b/scripts/compile.sh @@ -1,16 +1,38 @@ #!/bin/bash cd src -pyinstaller --specpath ../dist/cspec \ - --workpath ../dist/cbuild \ - --distpath ../dist/cdist \ - --add-data ../../src/py_to_uxf/appsettings.json:. \ - --hidden-import pynput.keyboard._xorg \ - --hidden-import pynput.mouse._xorg \ - --hidden-import pyfiglet.fonts \ - --collect-data pyfiglet \ - -n py_to_uxf \ - -y \ +#pyinstaller --specpath ../dist/cspec \ +# --workpath ../dist/cbuild \ +# --distpath ../dist/cdist \ +# --add-data ../../src/py_to_uxf/appsettings.json:. \ +# --hidden-import pynput.keyboard._xorg \ +# --hidden-import pynput.mouse._xorg \ +# --hidden-import pyfiglet.fonts \ +# --collect-data pyfiglet \ +# -n py_to_uxf \ +# -y \ +# py_to_uxf/main.py + +build=../dist/cbuild/ +python -m nuitka \ + --standalone \ + --follow-imports \ + --include-package=pkg_resources \ + --include-package=pynput.keyboard._xorg \ + --include-package=pynput.mouse._xorg \ + --include-package=pyfiglet.fonts \ + --include-package=Xlib \ + --include-package-data=pyfiglet \ + --output-dir=$build \ py_to_uxf/main.py -cd ../ \ No newline at end of file + +file="py_to_uxf/appsettings.json" +if [ -f "$file" ]; then + if [ -d "$build/main.dist/" ]; then + build=$build/main.dist/ + fi + cp $file $build +fi + +cd ../ diff --git a/src/py_to_uxf/startup.py b/src/py_to_uxf/startup.py index 6685baf..8e245f7 100644 --- a/src/py_to_uxf/startup.py +++ b/src/py_to_uxf/startup.py @@ -1,7 +1,9 @@ import os +import sys from cpl_core.application import StartupABC from cpl_core.configuration import ConfigurationABC, ConsoleArgument +from cpl_core.console import Console from cpl_core.dependency_injection import ServiceProviderABC, ServiceCollectionABC from cpl_core.environment import ApplicationEnvironment @@ -30,8 +32,11 @@ class Startup(StartupABC): environment.set_runtime_directory(os.path.dirname(__file__)) if os.path.isfile('py_to_uxf/appsettings.json'): configuration.add_json_file('py_to_uxf/appsettings.json', optional=False, output=False) - else: + elif os.path.isfile('appsettings.json'): configuration.add_json_file('appsettings.json', optional=False, output=False) + else: + Console.error(f'Expected config file appsettings.json') + sys.exit() configuration.add_console_argument(ConsoleArgument('-', 'p', [], ' ', False, [ ConsoleArgument('-', 'o', [], ' ', is_value_token_optional=False)