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/
#nuitka and makefile
#Build
*.bin
*.build
build/
Makefile
site-packages
calfbox/.deps

13
template/Makefile.in

@ -9,11 +9,17 @@
all: | calfbox
#Our Program
printf "prefix = \"$(PREFIX)\"" > compiledprefix.py
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)
mkdir build
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
#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:
mkdir -p site-packages
#First build the shared lib. Instead of running make install we create the lib ourselves directly
@ -35,6 +41,7 @@ calfbox:
clean:
cd template/calfbox && make distclean && rm -rf build
rm -rf build/
rm -rf site-packages
rm -f "$(PROGRAM).bin"
rm -rf "$(PROGRAM).build"

5
template/configure.template

@ -7,7 +7,6 @@
prefix=/usr/local
required_version_python=3.6
required_version_pyqt=5.0
required_version_nuitka=0.6
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)')
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"
set -e
#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
* 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)
### Environment:

5
template/gitignore.template

@ -104,11 +104,12 @@ venv.bak/
.mypy_cache/
#nuitka and makefile
#build process
*.bin
*.build
build/
Makefile
engine/compiledprefix.py
compiledprefix.py
site-packages
template/calfbox/.deps
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.
We need to be earliest, so let's put it here.
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
"""

Loading…
Cancel
Save