Browse Source

First step to remove nuitka dependency

master
Nils 4 years ago
parent
commit
a6fbdcd782
  1. 16
      __main__.py
  2. 3
      template/.gitignore
  3. 13
      template/Makefile.in
  4. 5
      template/configure.template
  5. 1
      template/documentation/readme.template
  6. 5
      template/gitignore.template
  7. 2
      template/start.py

16
__main__.py

@ -0,0 +1,16 @@
#!/usr/bin/env python3
# encoding: utf-8
# file: __main__.py
"""
This file is an alternativ to ./patroneo when using zipapp.
Any code changes in ./patroneo must be manually recplicated here.
"""
if __name__ == '__main__':
from template import start #Executes various start up checks and sets up our environment likes search paths
from qtgui import mainwindow #which in turn imports the engine and starts the engine
with start.profiler():
mainwindow.MainWindow().qtApp.exec_()
#Program is over. Code here does not get executed. Quit is done via NSM in mainWindow._nsmQuit

3
template/.gitignore

@ -104,9 +104,10 @@ venv.bak/
.mypy_cache/ .mypy_cache/
#nuitka and makefile #Build
*.bin *.bin
*.build *.build
build/
Makefile Makefile
site-packages site-packages
calfbox/.deps calfbox/.deps

13
template/Makefile.in

@ -9,11 +9,17 @@
all: | calfbox all: | calfbox
#Our Program #Our Program
printf "prefix = \"$(PREFIX)\"" > compiledprefix.py mkdir build
PYTHONPATH="site-packages" python3 -m nuitka --recurse-all --python-flag -O --warn-unusual-code --warn-implicit-exceptions --recurse-not-to=PyQt5 --show-progress --show-modules --file-reference-choice=runtime $(PROGRAM) cd build && printf "prefix = \"$(PREFIX)\"" > compiledprefix.py
cp -r patroneo __main__.py engine qtgui site-packages template build
#We only need the installed calfbox in local site-packages. The repo in template is full with build data anyway, don't zip that in.
rm -rf build/template/calfbox
#Clean all pycache in build
cd build && find . -type d -name "__pycache__" -exec rm -r {} +
python -m zipapp "build" --output="$(PROGRAM).bin" --python="/usr/bin/env python3"
rm compiledprefix.py rm compiledprefix.py
#A mode that just compiles calfbox locally so you can run the whole program standalone without nuitka #A mode that just compiles calfbox locally so you can run the whole program standalone
calfbox: calfbox:
mkdir -p site-packages mkdir -p site-packages
#First build the shared lib. Instead of running make install we create the lib ourselves directly #First build the shared lib. Instead of running make install we create the lib ourselves directly
@ -35,6 +41,7 @@ calfbox:
clean: clean:
cd template/calfbox && make distclean && rm -rf build cd template/calfbox && make distclean && rm -rf build
rm -rf build/
rm -rf site-packages rm -rf site-packages
rm -f "$(PROGRAM).bin" rm -f "$(PROGRAM).bin"
rm -rf "$(PROGRAM).build" rm -rf "$(PROGRAM).build"

5
template/configure.template

@ -7,7 +7,6 @@
prefix=/usr/local prefix=/usr/local
required_version_python=3.6 required_version_python=3.6
required_version_pyqt=5.0 required_version_pyqt=5.0
required_version_nuitka=0.6
for arg in "$@"; do for arg in "$@"; do
@ -47,10 +46,6 @@ python3 -c 'import PyQt5' >/dev/null 2>&1 || { echo >&2 "PyQt for Python3 >= $re
PYQTVERSION=$(python3 -c 'from PyQt5.QtCore import QT_VERSION_STR; print(QT_VERSION_STR)') PYQTVERSION=$(python3 -c 'from PyQt5.QtCore import QT_VERSION_STR; print(QT_VERSION_STR)')
if version_gt $required_version_pyqt $PYQTVERSION; then echo "PyQt must be version >= $required_version_pyqt but is $PYQTVERSION. Aborting."; exit 1; fi if version_gt $required_version_pyqt $PYQTVERSION; then echo "PyQt must be version >= $required_version_pyqt but is $PYQTVERSION. Aborting."; exit 1; fi
command -v nuitka3 >/dev/null 2>&1 || { echo >&2 "Nuitka3 is required but it's not installed. Aborting."; exit 1; }
NUITKAVERSION=$(python3 -c 'import nuitka.Version; print(nuitka.Version.getNuitkaVersion())')
if version_gt $required_version_nuitka $NUITKAVERSION; then echo "Nuitka3 must be version >= $required_version_nuitka but is $NUITKAVERSION. Aborting."; exit 1; fi
echo "Sub-Configure for calfbox" echo "Sub-Configure for calfbox"
set -e set -e
#We need to be in the directory, #We need to be in the directory,

1
template/documentation/readme.template

@ -37,7 +37,6 @@ It is possible to clone a git repository.
#### Build Dependencies #### Build Dependencies
* Bash * Bash
* Nuitka >= 0.6 (maybe earlier. Optional when running from source dir)
* GCC (development is done on 8.2, but most likely you can use a much earlier version) * GCC (development is done on 8.2, but most likely you can use a much earlier version)
### Environment: ### Environment:

5
template/gitignore.template

@ -104,11 +104,12 @@ venv.bak/
.mypy_cache/ .mypy_cache/
#nuitka and makefile #build process
*.bin *.bin
*.build *.build
build/
Makefile Makefile
engine/compiledprefix.py compiledprefix.py
site-packages site-packages
template/calfbox/.deps template/calfbox/.deps
template/calfbox/build template/calfbox/build

2
template/start.py

@ -65,7 +65,7 @@ logger.info("import")
"""set up python search path before the program starts and cbox gets imported. """set up python search path before the program starts and cbox gets imported.
We need to be earliest, so let's put it here. We need to be earliest, so let's put it here.
This is influence during compiling by creating a temporary file "compiledprefix.py". This is influence during compiling by creating a temporary file "compiledprefix.py".
Nuitka complies that in, when make is finished we delete it. pyzipapp archives that in, when make is finished we delete it.
#Default mode is a self-contained directory relative to the uncompiled patroneo python start script #Default mode is a self-contained directory relative to the uncompiled patroneo python start script
""" """

Loading…
Cancel
Save