Smaller bugfixes

This commit is contained in:
Sven Heidemann 2022-01-19 22:03:37 +01:00
parent b3e0083633
commit 60e09252c8
2 changed files with 39 additions and 12 deletions

View File

@ -1,16 +1,38 @@
#!/bin/bash #!/bin/bash
cd src cd src
pyinstaller --specpath ../dist/cspec \ #pyinstaller --specpath ../dist/cspec \
--workpath ../dist/cbuild \ # --workpath ../dist/cbuild \
--distpath ../dist/cdist \ # --distpath ../dist/cdist \
--add-data ../../src/py_to_uxf/appsettings.json:. \ # --add-data ../../src/py_to_uxf/appsettings.json:. \
--hidden-import pynput.keyboard._xorg \ # --hidden-import pynput.keyboard._xorg \
--hidden-import pynput.mouse._xorg \ # --hidden-import pynput.mouse._xorg \
--hidden-import pyfiglet.fonts \ # --hidden-import pyfiglet.fonts \
--collect-data pyfiglet \ # --collect-data pyfiglet \
-n py_to_uxf \ # -n py_to_uxf \
-y \ # -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 py_to_uxf/main.py
cd ../
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 ../

View File

@ -1,7 +1,9 @@
import os import os
import sys
from cpl_core.application import StartupABC from cpl_core.application import StartupABC
from cpl_core.configuration import ConfigurationABC, ConsoleArgument from cpl_core.configuration import ConfigurationABC, ConsoleArgument
from cpl_core.console import Console
from cpl_core.dependency_injection import ServiceProviderABC, ServiceCollectionABC from cpl_core.dependency_injection import ServiceProviderABC, ServiceCollectionABC
from cpl_core.environment import ApplicationEnvironment from cpl_core.environment import ApplicationEnvironment
@ -30,8 +32,11 @@ class Startup(StartupABC):
environment.set_runtime_directory(os.path.dirname(__file__)) environment.set_runtime_directory(os.path.dirname(__file__))
if os.path.isfile('py_to_uxf/appsettings.json'): if os.path.isfile('py_to_uxf/appsettings.json'):
configuration.add_json_file('py_to_uxf/appsettings.json', optional=False, output=False) 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) 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, [ configuration.add_console_argument(ConsoleArgument('-', 'p', [], ' ', False, [
ConsoleArgument('-', 'o', [], ' ', is_value_token_optional=False) ConsoleArgument('-', 'o', [], ' ', is_value_token_optional=False)