Make python plugins optional during the build process
This commit is contained in:
parent
bfaa85979d
commit
d1b57be370
@ -33,7 +33,9 @@
|
|||||||
#if QT_VERSION >= QT_VERSION_CHECK(5,12,0)
|
#if QT_VERSION >= QT_VERSION_CHECK(5,12,0)
|
||||||
#include "scriptintegrationplugin.h"
|
#include "scriptintegrationplugin.h"
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef WITH_PYTHON
|
||||||
#include "pythonintegrationplugin.h"
|
#include "pythonintegrationplugin.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "loggingcategories.h"
|
#include "loggingcategories.h"
|
||||||
#include "typeutils.h"
|
#include "typeutils.h"
|
||||||
@ -98,7 +100,9 @@ ThingManagerImplementation::ThingManagerImplementation(HardwareManager *hardware
|
|||||||
// Make sure this is always emitted after plugins and things are loaded
|
// Make sure this is always emitted after plugins and things are loaded
|
||||||
QMetaObject::invokeMethod(this, "onLoaded", Qt::QueuedConnection);
|
QMetaObject::invokeMethod(this, "onLoaded", Qt::QueuedConnection);
|
||||||
|
|
||||||
|
#ifdef WITH_PYTHON
|
||||||
PythonIntegrationPlugin::initPython();
|
PythonIntegrationPlugin::initPython();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
ThingManagerImplementation::~ThingManagerImplementation()
|
ThingManagerImplementation::~ThingManagerImplementation()
|
||||||
@ -120,7 +124,9 @@ ThingManagerImplementation::~ThingManagerImplementation()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef WITH_PYTHON
|
||||||
PythonIntegrationPlugin::deinitPython();
|
PythonIntegrationPlugin::deinitPython();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList ThingManagerImplementation::pluginSearchDirs()
|
QStringList ThingManagerImplementation::pluginSearchDirs()
|
||||||
@ -1293,6 +1299,7 @@ void ThingManagerImplementation::loadPlugins()
|
|||||||
qCWarning(dcThingManager()) << "Not loading JS plugin as JS plugin support is not included in this nymea instance.";
|
qCWarning(dcThingManager()) << "Not loading JS plugin as JS plugin support is not included in this nymea instance.";
|
||||||
#endif
|
#endif
|
||||||
} else if (entry.startsWith("integrationplugin") && entry.endsWith(".py")) {
|
} else if (entry.startsWith("integrationplugin") && entry.endsWith(".py")) {
|
||||||
|
#ifdef WITH_PYTHON
|
||||||
PythonIntegrationPlugin *p = new PythonIntegrationPlugin(this);
|
PythonIntegrationPlugin *p = new PythonIntegrationPlugin(this);
|
||||||
bool ok = p->loadScript(fi.absoluteFilePath());
|
bool ok = p->loadScript(fi.absoluteFilePath());
|
||||||
if (ok) {
|
if (ok) {
|
||||||
@ -1300,6 +1307,9 @@ void ThingManagerImplementation::loadPlugins()
|
|||||||
} else {
|
} else {
|
||||||
delete p;
|
delete p;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
qCWarning(dcThingManager()) << "Not loading Python plugin as Python plugin support is not included in this nymea instance.2";
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
// Not a known plugin type
|
// Not a known plugin type
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@ -14,17 +14,22 @@ PKGCONFIG += nymea-mqtt nymea-networkmanager
|
|||||||
# For everything below python 3.8 we need to manually select one
|
# For everything below python 3.8 we need to manually select one
|
||||||
packagesExist(python3-embed) {
|
packagesExist(python3-embed) {
|
||||||
PKGCONFIG += python3-embed
|
PKGCONFIG += python3-embed
|
||||||
|
CONFIG += python
|
||||||
} else:packagesExist(python-3.5) {
|
} else:packagesExist(python-3.5) {
|
||||||
# xenial, stretch
|
# xenial, stretch
|
||||||
PKGCONFIG += python-3.5
|
PKGCONFIG += python-3.5
|
||||||
|
CONFIG += python
|
||||||
} else:packagesExist(python-3.6) {
|
} else:packagesExist(python-3.6) {
|
||||||
# bionic
|
# bionic
|
||||||
PKGCONFIG += python-3.6
|
PKGCONFIG += python-3.6
|
||||||
|
CONFIG += python
|
||||||
} else:packagesExist(python-3.7) {
|
} else:packagesExist(python-3.7) {
|
||||||
# buster, eoan
|
# buster, eoan
|
||||||
PKGCONFIG += python-3.7
|
PKGCONFIG += python-3.7
|
||||||
|
CONFIG += python
|
||||||
} else {
|
} else {
|
||||||
error("Python development package not found.")
|
message("Python development package not found. Building without python support.")
|
||||||
|
CONFIG -= python
|
||||||
}
|
}
|
||||||
|
|
||||||
target.path = $$[QT_INSTALL_LIBS]
|
target.path = $$[QT_INSTALL_LIBS]
|
||||||
@ -38,20 +43,8 @@ RESOURCES += $$top_srcdir/icons.qrc \
|
|||||||
HEADERS += nymeacore.h \
|
HEADERS += nymeacore.h \
|
||||||
integrations/apikeysprovidersloader.h \
|
integrations/apikeysprovidersloader.h \
|
||||||
integrations/plugininfocache.h \
|
integrations/plugininfocache.h \
|
||||||
integrations/python/pynymealogginghandler.h \
|
|
||||||
integrations/python/pynymeamodule.h \
|
|
||||||
integrations/python/pyparam.h \
|
|
||||||
integrations/python/pystdouthandler.h \
|
|
||||||
integrations/python/pything.h \
|
|
||||||
integrations/python/pythingactioninfo.h \
|
|
||||||
integrations/python/pythingdescriptor.h \
|
|
||||||
integrations/python/pythingdiscoveryinfo.h \
|
|
||||||
integrations/python/pythingpairinginfo.h \
|
|
||||||
integrations/python/pythingsetupinfo.h \
|
|
||||||
integrations/python/pyutils.h \
|
|
||||||
integrations/thingmanagerimplementation.h \
|
integrations/thingmanagerimplementation.h \
|
||||||
integrations/translator.h \
|
integrations/translator.h \
|
||||||
integrations/pythonintegrationplugin.h \
|
|
||||||
experiences/experiencemanager.h \
|
experiences/experiencemanager.h \
|
||||||
ruleengine/ruleengine.h \
|
ruleengine/ruleengine.h \
|
||||||
ruleengine/rule.h \
|
ruleengine/rule.h \
|
||||||
@ -134,7 +127,6 @@ SOURCES += nymeacore.cpp \
|
|||||||
integrations/plugininfocache.cpp \
|
integrations/plugininfocache.cpp \
|
||||||
integrations/thingmanagerimplementation.cpp \
|
integrations/thingmanagerimplementation.cpp \
|
||||||
integrations/translator.cpp \
|
integrations/translator.cpp \
|
||||||
integrations/pythonintegrationplugin.cpp \
|
|
||||||
experiences/experiencemanager.cpp \
|
experiences/experiencemanager.cpp \
|
||||||
ruleengine/ruleengine.cpp \
|
ruleengine/ruleengine.cpp \
|
||||||
ruleengine/rule.cpp \
|
ruleengine/rule.cpp \
|
||||||
@ -210,11 +202,32 @@ SOURCES += nymeacore.cpp \
|
|||||||
debugreportgenerator.cpp \
|
debugreportgenerator.cpp \
|
||||||
platform/platform.cpp \
|
platform/platform.cpp \
|
||||||
|
|
||||||
|
|
||||||
versionAtLeast(QT_VERSION, 5.12.0) {
|
versionAtLeast(QT_VERSION, 5.12.0) {
|
||||||
|
message("Building with JS plugin support")
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
integrations/scriptintegrationplugin.h
|
integrations/scriptintegrationplugin.h
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
integrations/scriptintegrationplugin.cpp
|
integrations/scriptintegrationplugin.cpp
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CONFIG(python) {
|
||||||
|
message("Building with Python plugin support")
|
||||||
|
DEFINES += WITH_PYTHON
|
||||||
|
HEADERS += \
|
||||||
|
integrations/pythonintegrationplugin.h \
|
||||||
|
integrations/python/pynymealogginghandler.h \
|
||||||
|
integrations/python/pynymeamodule.h \
|
||||||
|
integrations/python/pyparam.h \
|
||||||
|
integrations/python/pystdouthandler.h \
|
||||||
|
integrations/python/pything.h \
|
||||||
|
integrations/python/pythingactioninfo.h \
|
||||||
|
integrations/python/pythingdescriptor.h \
|
||||||
|
integrations/python/pythingdiscoveryinfo.h \
|
||||||
|
integrations/python/pythingpairinginfo.h \
|
||||||
|
integrations/python/pythingsetupinfo.h \
|
||||||
|
integrations/python/pyutils.h
|
||||||
|
|
||||||
|
SOURCES += \
|
||||||
|
integrations/pythonintegrationplugin.cpp
|
||||||
|
}
|
||||||
|
|||||||
@ -84,7 +84,6 @@ message("Qt version:" $$[QT_VERSION])
|
|||||||
message("Copyright $${COPYRIGHT_YEAR_FROM} - $${COPYRIGHT_YEAR_TO}")
|
message("Copyright $${COPYRIGHT_YEAR_FROM} - $${COPYRIGHT_YEAR_TO}")
|
||||||
message("Building nymea version $${NYMEA_VERSION_STRING}")
|
message("Building nymea version $${NYMEA_VERSION_STRING}")
|
||||||
message("JSON-RPC API version $${JSON_PROTOCOL_VERSION_MAJOR}.$${JSON_PROTOCOL_VERSION_MINOR}")
|
message("JSON-RPC API version $${JSON_PROTOCOL_VERSION_MAJOR}.$${JSON_PROTOCOL_VERSION_MINOR}")
|
||||||
message("REST API version $${REST_API_VERSION}")
|
|
||||||
message("Source directory: $${top_srcdir}")
|
message("Source directory: $${top_srcdir}")
|
||||||
message("Build directory: $${top_builddir}")
|
message("Build directory: $${top_builddir}")
|
||||||
message("Translations: $${TRANSLATIONS}")
|
message("Translations: $${TRANSLATIONS}")
|
||||||
|
|||||||
Reference in New Issue
Block a user