Browse Source

First step to remove nuitka dependency

master
Nils 3 years ago
parent
commit
a6fbdcd782
  1. 16
      __main__.py
  2. 3
      template/.gitignore
  3. 15
      template/Makefile.in
  4. 7
      template/configure.template
  5. 3
      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

15
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"
@ -57,7 +64,7 @@ install:
install -D -m 644 README.md $(DESTDIR)$(PREFIX)/share/doc/$(PROGRAM)/README.md
install -D -m 644 LICENSE $(DESTDIR)$(PREFIX)/share/doc/$(PROGRAM)/LICENSE
install -D -m 644 desktop/desktop.desktop $(DESTDIR)$(PREFIX)/share/applications/org.laborejo.$(PROGRAM).desktop
install -D -m 644 desktop/desktop.desktop $(DESTDIR)$(PREFIX)/share/applications/org.laborejo.$(PROGRAM).desktop
install -d $(DESTDIR)$(PREFIX)/share/man/man1
gzip -c documentation/$(PROGRAM).1 > $(DESTDIR)$(PREFIX)/share/man/man1/$(PROGRAM).1.gz

7
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
@ -24,7 +23,7 @@ for arg in "$@"; do
--help)
echo 'usage: ./configure [options]'
echo 'options:'
echo ' --prefix=<path>: installation prefix'
echo ' --prefix=<path>: installation prefix'
#echo ' --enable-debug: include debug symbols'
#echo ' --disable-debug: do not include debug symbols'
echo 'all invalid options are silently ignored'
@ -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,

3
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:
@ -90,7 +89,7 @@ You can run <name> after extracting the release archive or cloning from git, wit
### Calfbox
"Calfbox" is the name of our internal realtime midi/audio python module.
* You can either choose to install the module systemwide, which will make running all Laborejo Software Suite programs more convenient (when run from the source dir). Please consult https://github.com/kfoltman/calfbox
* You can either choose to install the module systemwide, which will make running all Laborejo Software Suite programs more convenient (when run from the source dir). Please consult https://github.com/kfoltman/calfbox
* Or you just run `./configure` and `make calfbox` without subsequent install, which creates a `site-packages` directory in the source dir.
* A third option is `<shortname> --mute` which runs without sound at all and does not need calfbox.

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