mirror of
https://github.com/nymea/nymea-plugins.git
synced 2026-07-17 00:36:35 +02:00
Fetch pip packages at build time
This commit is contained in:
parent
6eaa507bbc
commit
2fad0b7f80
7
debian/control
vendored
7
debian/control
vendored
@ -19,6 +19,9 @@ Build-depends: libboblight-dev,
|
||||
libsodium-dev,
|
||||
libudev-dev,
|
||||
libhidapi-dev,
|
||||
python3-pip:native,
|
||||
python3-setuptools,
|
||||
python3-wheel:native,
|
||||
Standards-Version: 3.9.3
|
||||
|
||||
|
||||
@ -274,7 +277,6 @@ Package: nymea-plugin-fastcom
|
||||
Architecture: any
|
||||
Depends: ${misc:Depends},
|
||||
nymea-plugins-translations,
|
||||
python3-pip,
|
||||
Description: nymea.io plugin for fast.com based internet speed test
|
||||
The nymea daemon is a plugin based IoT (Internet of Things) server. The
|
||||
server works like a translator for devices, things and services and
|
||||
@ -485,7 +487,6 @@ Architecture: any
|
||||
Depends: ${shlibs:Depends},
|
||||
${misc:Depends},
|
||||
nymea-plugins-translations,
|
||||
python3-pip,
|
||||
Description: nymea.io plugin for neato
|
||||
The nymea daemon is a plugin based IoT (Internet of Things) server. The
|
||||
server works like a translator for devices, things and services and
|
||||
@ -957,8 +958,6 @@ Description: nymea.io plugin for Sonos smart speakers
|
||||
Package: nymea-plugin-sunposition
|
||||
Architecture: any
|
||||
Depends: ${misc:Depends},
|
||||
libatlas-base-dev,
|
||||
python3-pip,
|
||||
nymea-plugins-translations,
|
||||
Description: nymea.io plugin for calculating the sun position
|
||||
The nymea daemon is a plugin based IoT (Internet of Things) server. The
|
||||
|
||||
4
debian/nymea-plugin-fastcom.install.in
vendored
4
debian/nymea-plugin-fastcom.install.in
vendored
@ -1,3 +1 @@
|
||||
fastcom/integrationpluginfastcom.json usr/lib/@DEB_HOST_MULTIARCH@/nymea/plugins/fastcom/
|
||||
fastcom/integrationpluginfastcom.py usr/lib/@DEB_HOST_MULTIARCH@/nymea/plugins/fastcom/
|
||||
fastcom/requirements.txt usr/lib/@DEB_HOST_MULTIARCH@/nymea/plugins/fastcom/
|
||||
usr/lib/@DEB_HOST_MULTIARCH@/nymea/plugins/fastcom/
|
||||
|
||||
4
debian/nymea-plugin-neatobotvac.install.in
vendored
4
debian/nymea-plugin-neatobotvac.install.in
vendored
@ -1,3 +1 @@
|
||||
neatobotvac/integrationpluginneatobotvac.json usr/lib/@DEB_HOST_MULTIARCH@/nymea/plugins/neatobotvac/
|
||||
neatobotvac/integrationpluginneatobotvac.py usr/lib/@DEB_HOST_MULTIARCH@/nymea/plugins/neatobotvac/
|
||||
neatobotvac/requirements.txt usr/lib/@DEB_HOST_MULTIARCH@/nymea/plugins/neatobotvac/
|
||||
usr/lib/@DEB_HOST_MULTIARCH@/nymea/plugins/neatobotvac/
|
||||
|
||||
5
debian/nymea-plugin-sunposition.install.in
vendored
5
debian/nymea-plugin-sunposition.install.in
vendored
@ -1,4 +1 @@
|
||||
sunposition/integrationpluginsunposition.json usr/lib/@DEB_HOST_MULTIARCH@/nymea/plugins/sunposition/
|
||||
sunposition/integrationpluginsunposition.py usr/lib/@DEB_HOST_MULTIARCH@/nymea/plugins/sunposition/
|
||||
sunposition/sunposition.py usr/lib/@DEB_HOST_MULTIARCH@/nymea/plugins/sunposition/
|
||||
sunposition/requirements.txt usr/lib/@DEB_HOST_MULTIARCH@/nymea/plugins/sunposition/
|
||||
usr/lib/@DEB_HOST_MULTIARCH@/nymea/plugins/sunposition/
|
||||
|
||||
15
debian/rules
vendored
15
debian/rules
vendored
@ -8,14 +8,6 @@ $(PREPROCESS_FILES:.in=): %: %.in
|
||||
sed 's,/@DEB_HOST_MULTIARCH@,$(DEB_HOST_MULTIARCH:%=/%),g' $< > $@
|
||||
chmod --reference=$< $@
|
||||
|
||||
# Auto-generate install/remove hooks to fetch/cleanup python dependencies from requirements.txt
|
||||
PYTHON_REQUIREMENTS := $(shell find -name requirements.txt)
|
||||
$(PYTHON_REQUIREMENTS:.txt=): %: %.txt
|
||||
$(eval PYTHON_PLUGIN=$(subst /requirements.txt,,$<))
|
||||
echo "#DEBHELPER#" | tee debian/nymea-plugin-$(PYTHON_PLUGIN).postinst | tee debian/nymea-plugin-$(PYTHON_PLUGIN).prerm
|
||||
echo "pip3 install --require-hashes --upgrade -r usr/lib/$(DEB_HOST_MULTIARCH)/nymea/plugins/$(PYTHON_PLUGIN)/requirements.txt -t usr/lib/$(DEB_HOST_MULTIARCH)/nymea/plugins/$(PYTHON_PLUGIN)/modules" >> debian/nymea-plugin-$(PYTHON_PLUGIN).postinst
|
||||
echo "rm -rf usr/lib/$(DEB_HOST_MULTIARCH)/nymea/plugins/$(PYTHON_PLUGIN)/modules" >> debian/nymea-plugin-$(PYTHON_PLUGIN).prerm
|
||||
|
||||
%:
|
||||
dh $@ --parallel
|
||||
|
||||
@ -23,7 +15,7 @@ override_dh_auto_build:
|
||||
dh_auto_build
|
||||
make lrelease
|
||||
|
||||
override_dh_install: $(PREPROCESS_FILES:.in=) $(PYTHON_REQUIREMENTS:.txt=)
|
||||
override_dh_install: $(PREPROCESS_FILES:.in=)
|
||||
dh_install --fail-missing
|
||||
|
||||
override_dh_auto_clean:
|
||||
@ -32,3 +24,8 @@ override_dh_auto_clean:
|
||||
find -name *.qm -exec rm {} \;
|
||||
rm -rf $(PREPROCESS_FILES:.in=)
|
||||
|
||||
override_dh_shlibdeps:
|
||||
# Excluding numpy as it links against binaries in a plugins module dir
|
||||
# which can't be found by shlibdeps.
|
||||
# A better way would be to generate lib paths to them...
|
||||
dh_shlibdeps --exclude=numpy
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
TEMPLATE = aux
|
||||
PY_SOURCES = integrationpluginfastcom.py
|
||||
|
||||
OTHER_FILES = integrationpluginfastcom.py \
|
||||
integrationpluginfastcom.json
|
||||
include(../python-plugins.pri)
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
TEMPLATE = aux
|
||||
|
||||
OTHER_FILES = integrationpluginneatobotvac.json \
|
||||
integrationpluginneatobotvac.py
|
||||
PY_SOURCES += integrationpluginneatobotvac.py
|
||||
|
||||
include(../python-plugins.pri)
|
||||
|
||||
31
python-plugins.pri
Normal file
31
python-plugins.pri
Normal file
@ -0,0 +1,31 @@
|
||||
# Importing this file will set up most needed things for python plugins.
|
||||
# IMPORTANT: This file needs to be included after defining the plugin SOURCES
|
||||
#
|
||||
# Example python plugin .pro file:
|
||||
#
|
||||
# PY_SOURCES += integrationpluginexample.py
|
||||
# include(../python-plugins.pri)
|
||||
|
||||
TEMPLATE = aux
|
||||
|
||||
JSONFILE=$${_PRO_FILE_PWD_}/integrationplugin"$$TARGET".json
|
||||
REQUIREMENTSFILE=$${_PRO_FILE_PWD_}/requirements.txt
|
||||
|
||||
# Make the device plugin json file visible in the Qt Creator
|
||||
OTHER_FILES *= $$JSONFILE $$PY_SOURCES
|
||||
|
||||
# Add a make requirements target to fetch requirements
|
||||
requirements.commands = pip3 install -r $${_PRO_FILE_PWD_}/requirements.txt -t $${_PRO_FILE_PWD_}/modules/
|
||||
QMAKE_EXTRA_TARGETS += requirements
|
||||
|
||||
|
||||
# Install plugin
|
||||
target.path = $$[QT_INSTALL_LIBS]/nymea/plugins/$${TARGET}
|
||||
target.files += $${OTHER_FILES}
|
||||
|
||||
modules.path = $$[QT_INSTALL_LIBS]/nymea/plugins/$${TARGET}
|
||||
modules.files = $${_PRO_FILE_PWD_}/modules/
|
||||
modules.depends += requirements
|
||||
|
||||
INSTALLS += target modules
|
||||
|
||||
@ -35,4 +35,5 @@ simplejson==3.17.2 \
|
||||
--hash=sha256:8acf76443cfb5c949b6e781c154278c059b09ac717d2757a830c869ba000cf8d \
|
||||
--hash=sha256:934115642c8ba9659b402c8bdbdedb48651fb94b576e3b3efd1ccb079609b04a \
|
||||
--hash=sha256:e058c7656c44fb494a11443191e381355388443d543f6fc1a245d5d238544396 \
|
||||
--hash=sha256:7ae6e6af2dc617d200fcebc943059ef7e60ddc4de49deb7317f0183ba5bdcdf6
|
||||
--hash=sha256:7ae6e6af2dc617d200fcebc943059ef7e60ddc4de49deb7317f0183ba5bdcdf6 \
|
||||
--hash=sha256:2862beabfb9097a745a961426fe7daf66e1714151da8bb9a0c430dde3d59c7c0
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
TEMPLATE = aux
|
||||
|
||||
OTHER_FILES = integrationpluginsunposition.json \
|
||||
integrationpluginsunposition.py
|
||||
PY_SOURCES = integrationpluginsunposition.py
|
||||
|
||||
include(../python-plugins.pri)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user