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

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

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

3
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:
@ -90,7 +89,7 @@ You can run <name> after extracting the release archive or cloning from git, wit
### Calfbox ### Calfbox
"Calfbox" is the name of our internal realtime midi/audio python module. "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. * 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. * 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/ .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