Merge branch 'openwrt:master' into master
This commit is contained in:
commit
c3ea94bfc5
12 changed files with 231 additions and 5030 deletions
|
@ -1,70 +0,0 @@
|
||||||
include $(TOPDIR)/rules.mk
|
|
||||||
|
|
||||||
PKG_NAME:=cni-protocol
|
|
||||||
PKG_VERSION:=20231008
|
|
||||||
PKG_RELEASE:=1
|
|
||||||
|
|
||||||
PKG_MAINTAINER:=Oskari Rauta <oskari.rauta@gmail.com>
|
|
||||||
|
|
||||||
include $(INCLUDE_DIR)/package.mk
|
|
||||||
|
|
||||||
define Package/cni-protocol
|
|
||||||
SECTION:=net
|
|
||||||
CATEGORY:=Network
|
|
||||||
TITLE:=cni netifd protocol
|
|
||||||
PKGARCH:=all
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/cni-protocol/description
|
|
||||||
protocol support for netavark/cni networks for netifd
|
|
||||||
makes defining networks for podman and other similar
|
|
||||||
systems easier and simple.
|
|
||||||
|
|
||||||
with protocol, a network where firewall and portmapper
|
|
||||||
management is disabled, control of firewalling, whether
|
|
||||||
it was exposing ports, and forwarding to them from wan,
|
|
||||||
or limiting/accepting access to other networks such
|
|
||||||
as lan can made through openwrt's own firewalling
|
|
||||||
configuration.
|
|
||||||
|
|
||||||
example configuration could be as following:
|
|
||||||
- lan network: 10.0.0.0/16 (255.255.0.0)
|
|
||||||
- container network: 10.129.0.1/24 (255.255.255.0)
|
|
||||||
|
|
||||||
Add a network configuration for your container network
|
|
||||||
using cni protocol. Then create firewall zone for it.
|
|
||||||
|
|
||||||
You could create a new container/pod with static ip
|
|
||||||
address 10.129.0.2 (as 10.129.0.1 as container network's
|
|
||||||
gateway).
|
|
||||||
|
|
||||||
Easily define permissions so that local networks can
|
|
||||||
connect to cni network, but not the other way around.
|
|
||||||
Also you want to allow forwarding from/to wan.
|
|
||||||
|
|
||||||
Now, as cni cannot access local dns, make a rule for
|
|
||||||
your firewall to accept connections from cni network
|
|
||||||
to port 53 (dns).
|
|
||||||
|
|
||||||
Now all you have to do, is make redirects to your firewall
|
|
||||||
and point them to 10.129.0.2 and connections from wan are
|
|
||||||
redirectered to containers/pods.
|
|
||||||
|
|
||||||
Protocol has 2 settings: device and delay. Sometimes polling
|
|
||||||
interfaces takes some time, and in that case you might want
|
|
||||||
to add few seconds to delay. Otherwise, it can be excluded
|
|
||||||
from configuration.
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Build/Configure
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Build/Compile
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/cni-protocol/install
|
|
||||||
$(INSTALL_DIR) $(1)/lib/netifd/proto
|
|
||||||
$(INSTALL_BIN) ./files/cni.sh $(1)/lib/netifd/proto/cni.sh
|
|
||||||
endef
|
|
||||||
|
|
||||||
$(eval $(call BuildPackage,cni-protocol))
|
|
|
@ -1,68 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
[ -n "$INCLUDE_ONLY" ] || {
|
|
||||||
. /lib/functions.sh
|
|
||||||
. ../netifd-proto.sh
|
|
||||||
init_proto "$@"
|
|
||||||
}
|
|
||||||
|
|
||||||
proto_cni_init_config() {
|
|
||||||
no_device=0
|
|
||||||
available=0
|
|
||||||
|
|
||||||
proto_config_add_string "device:device"
|
|
||||||
proto_config_add_int "delay"
|
|
||||||
}
|
|
||||||
|
|
||||||
proto_cni_setup() {
|
|
||||||
local cfg="$1"
|
|
||||||
local iface="$2"
|
|
||||||
local device delay
|
|
||||||
|
|
||||||
json_get_vars device delay
|
|
||||||
|
|
||||||
[ -n "$device" ] || {
|
|
||||||
echo "No cni interface specified"
|
|
||||||
proto_notify_error "$cfg" NO_DEVICE
|
|
||||||
proto_set_available "$cfg" 0
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
|
|
||||||
[ -n "$delay" ] && sleep "$delay"
|
|
||||||
|
|
||||||
[ -L "/sys/class/net/${iface}" ] || {
|
|
||||||
echo "The specified interface $iface is not present"
|
|
||||||
proto_notify_error "$cfg" NO_DEVICE
|
|
||||||
proto_set_available "$cfg" 0
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
|
|
||||||
local ipaddr netmask broadcast route routemask routesrc
|
|
||||||
|
|
||||||
ipaddr=$(ip -4 -o a show "$iface" | awk '{ print $4 }' | cut -d '/' -f1)
|
|
||||||
netmask=$(ip -4 -o a show "$iface" | awk '{ print $4 }' | cut -d '/' -f2)
|
|
||||||
broadcast=$(ip -4 -o a show "$iface" | awk '{ print $6 }')
|
|
||||||
route=$(ip -4 -o r show dev "$iface" | awk '{ print $1 }' | cut -d '/' -f1)
|
|
||||||
routemask=$(ip -4 -o r show dev "$iface" | awk '{ print $1 }' | cut -d '/' -f2)
|
|
||||||
routesrc=$(ip -4 -o r show dev "$iface" | awk '{ print $7 }')
|
|
||||||
|
|
||||||
[ -z "$ipaddr" ] && {
|
|
||||||
echo "interface $iface does not have ip address"
|
|
||||||
proto_notify_error "$cfg" NO_IPADDRESS
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
|
|
||||||
proto_init_update "$iface" 1
|
|
||||||
[ -n "$ipaddr" ] && proto_add_ipv4_address "$ipaddr" "$netmask" "$broadcast" ""
|
|
||||||
[ -n "$route" ] && proto_add_ipv4_route "$route" "$routemask" "" "$routesrc" ""
|
|
||||||
proto_send_update "$cfg"
|
|
||||||
}
|
|
||||||
|
|
||||||
proto_cni_teardown() {
|
|
||||||
local cfg="$1"
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
[ -n "$INCLUDE_ONLY" ] || {
|
|
||||||
add_protocol cni
|
|
||||||
}
|
|
87
net/external-protocol/Makefile
Normal file
87
net/external-protocol/Makefile
Normal file
|
@ -0,0 +1,87 @@
|
||||||
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
|
PKG_NAME:=external-protocol
|
||||||
|
PKG_VERSION:=20231119
|
||||||
|
PKG_RELEASE:=1
|
||||||
|
|
||||||
|
PKG_MAINTAINER:=Oskari Rauta <oskari.rauta@gmail.com>
|
||||||
|
|
||||||
|
include $(INCLUDE_DIR)/package.mk
|
||||||
|
|
||||||
|
define Package/external-protocol
|
||||||
|
SECTION:=net
|
||||||
|
CATEGORY:=Network
|
||||||
|
TITLE:=externally managed protocol
|
||||||
|
PKGARCH:=all
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/external-protocol/description
|
||||||
|
external protocol is a general protocol for assisting
|
||||||
|
setup of many virtual devices that lack proper
|
||||||
|
protocol support in openwrt. Such as netavark, cni and
|
||||||
|
netbird for example. External protocol is supposed
|
||||||
|
to be managed with external software, not directly.
|
||||||
|
|
||||||
|
external protocol works automaticly on the background
|
||||||
|
and sets up netifd details when interface comes up or
|
||||||
|
goes down. This allows one to easily add interface to
|
||||||
|
a firewall zone.
|
||||||
|
|
||||||
|
as a example use case, podman, with network where it's
|
||||||
|
internal firewall and portmapper are disabled, control
|
||||||
|
of firewalling, whether it was exposing ports or
|
||||||
|
limiting/accepting access between networks, such as
|
||||||
|
lan can be made through openwrt's own firewalling
|
||||||
|
configuration if you used external protocol.
|
||||||
|
|
||||||
|
podman example configuration could be as following:
|
||||||
|
- lan network: 10.0.0.0/16 (255.255.0.0)
|
||||||
|
- container network: 10.129.0.1/24 (255.255.255.0)
|
||||||
|
|
||||||
|
Add a network configuration for your container network
|
||||||
|
using external protocol. Then create firewall zone for it.
|
||||||
|
|
||||||
|
You could create a new container/pod with static ip
|
||||||
|
address 10.129.0.2 (as 10.129.0.1 as container network's
|
||||||
|
gateway).
|
||||||
|
|
||||||
|
Easily define permissions so that local networks can
|
||||||
|
connect to container network, but not the other way around.
|
||||||
|
Also you want to allow forwarding from/to wan.
|
||||||
|
|
||||||
|
Now, as container cannot access local dns, make a rule for
|
||||||
|
your firewall to accept connections from container network
|
||||||
|
to port 53 (dns).
|
||||||
|
|
||||||
|
Now all you have to do, is make redirects to your firewall
|
||||||
|
and point them to 10.129.0.2 and connections from wan are
|
||||||
|
redirectered to containers/pods.
|
||||||
|
|
||||||
|
external protocol also works for other applications as
|
||||||
|
well that are using veth/tun/etc devices and don't have
|
||||||
|
a hand-tailored protocol available, such as vpn service
|
||||||
|
netbird.
|
||||||
|
|
||||||
|
Protocol has 3 settings: device, searchdomain and delay.
|
||||||
|
Sometimes polling interfaces takes some time, and in
|
||||||
|
that case you might want to add few seconds to delay.
|
||||||
|
Otherwise, it can be excluded from configuration.
|
||||||
|
Option for searchdomain is also completely optional.
|
||||||
|
|
||||||
|
package was previously known as cni protocol but as
|
||||||
|
it can be used on so many other things, naming became
|
||||||
|
mis-leading and it was renamed to external protocol.
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Build/Configure
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Build/Compile
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/external-protocol/install
|
||||||
|
$(INSTALL_DIR) $(1)/lib/netifd/proto
|
||||||
|
$(INSTALL_BIN) ./files/external.sh $(1)/lib/netifd/proto/external.sh
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(eval $(call BuildPackage,external-protocol))
|
141
net/external-protocol/files/external.sh
Executable file
141
net/external-protocol/files/external.sh
Executable file
|
@ -0,0 +1,141 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
[ -n "$INCLUDE_ONLY" ] || {
|
||||||
|
. /lib/functions.sh
|
||||||
|
. ../netifd-proto.sh
|
||||||
|
init_proto "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
proto_external_init_config() {
|
||||||
|
no_device=0
|
||||||
|
available=0
|
||||||
|
|
||||||
|
proto_config_add_string "device:device"
|
||||||
|
proto_config_add_string "searchdomain"
|
||||||
|
proto_config_add_int "delay"
|
||||||
|
}
|
||||||
|
|
||||||
|
proto_external_setup() {
|
||||||
|
local cfg="$1"
|
||||||
|
local iface="$2"
|
||||||
|
local device searchdomain delay
|
||||||
|
|
||||||
|
json_get_vars device searchdomain delay
|
||||||
|
|
||||||
|
[ -n "$device" ] || {
|
||||||
|
echo "External protocol interface is not specified"
|
||||||
|
proto_notify_error "$cfg" NO_DEVICE
|
||||||
|
proto_set_available "$cfg" 0
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
[ -n "$delay" ] && sleep "$delay"
|
||||||
|
|
||||||
|
[ -L "/sys/class/net/${iface}" ] || {
|
||||||
|
echo "External protocol interface $iface is not present"
|
||||||
|
proto_notify_error "$cfg" NO_DEVICE
|
||||||
|
proto_set_available "$cfg" 0
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
IP4ADDRS=
|
||||||
|
IP6ADDRS=
|
||||||
|
|
||||||
|
local addresses="$(ip -json address list dev "$iface")"
|
||||||
|
json_init
|
||||||
|
json_load "{\"addresses\":${addresses}}"
|
||||||
|
|
||||||
|
if json_is_a addresses array; then
|
||||||
|
json_select addresses
|
||||||
|
json_select 1
|
||||||
|
|
||||||
|
if json_is_a addr_info array; then
|
||||||
|
json_select addr_info
|
||||||
|
|
||||||
|
local i=1
|
||||||
|
while json_is_a ${i} object; do
|
||||||
|
json_select ${i}
|
||||||
|
json_get_vars scope family local prefixlen broadcast
|
||||||
|
|
||||||
|
if [ "${scope}" == "global" ]; then
|
||||||
|
case "${family}" in
|
||||||
|
inet)
|
||||||
|
append IP4ADDRS "$local/$prefixlen/$broadcast/"
|
||||||
|
;;
|
||||||
|
|
||||||
|
inet6)
|
||||||
|
append IP6ADDRS "$local/$prefixlen/$broadcast///"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
json_select ..
|
||||||
|
i=$(( i + 1 ))
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
IP4ROUTES=
|
||||||
|
IP6ROUTES=
|
||||||
|
|
||||||
|
local routes="$(ip -json route list dev "$iface")"
|
||||||
|
json_init
|
||||||
|
json_load "{\"routes\":${routes}}"
|
||||||
|
|
||||||
|
if json_is_a routes array;then
|
||||||
|
json_select routes
|
||||||
|
|
||||||
|
local i=1
|
||||||
|
while json_is_a ${i} object; do
|
||||||
|
json_select ${i}
|
||||||
|
json_get_vars dst gateway metric prefsrc
|
||||||
|
|
||||||
|
case "${dst}" in
|
||||||
|
*:*/*)
|
||||||
|
append IP6ROUTES "$dst/$gateway/$metric///$prefsrc"
|
||||||
|
;;
|
||||||
|
*.*/*)
|
||||||
|
append IP4ROUTES "$dst/$gateway/$metric///$prefsrc"
|
||||||
|
;;
|
||||||
|
*:*)
|
||||||
|
append IP6ROUTES "$dst/128/$gateway/$metric///$prefsrc"
|
||||||
|
;;
|
||||||
|
*.*)
|
||||||
|
append IP4ROUTES "$dst/32/$gateway/$metric///$prefsrc"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
json_select ..
|
||||||
|
i=$(( i + 1 ))
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ -z "${IP4ADDRS}" -a -z "${IP6ADDRS}" ] && {
|
||||||
|
echo "interface $iface does not have ip address"
|
||||||
|
proto_notify_error "$cfg" NO_IPADDRESS
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
proto_init_update "$iface" 1
|
||||||
|
|
||||||
|
PROTO_IPADDR="${IP4ADDRS}"
|
||||||
|
PROTO_IP6ADDR="${IP6ADDRS}"
|
||||||
|
|
||||||
|
PROTO_ROUTE="${IP4ROUTES}"
|
||||||
|
PROTO_ROUTE6="${IP6ROUTES}"
|
||||||
|
|
||||||
|
[ -n "$searchdomain" ] && proto_add_dns_search "$searchdomain"
|
||||||
|
|
||||||
|
echo "$iface is up"
|
||||||
|
|
||||||
|
proto_send_update "$cfg"
|
||||||
|
}
|
||||||
|
|
||||||
|
proto_external_teardown() {
|
||||||
|
local cfg="$1"
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
[ -n "$INCLUDE_ONLY" ] || {
|
||||||
|
add_protocol external
|
||||||
|
}
|
|
@ -8,12 +8,12 @@
|
||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=domoticz
|
PKG_NAME:=domoticz
|
||||||
PKG_VERSION:=2022.1
|
PKG_VERSION:=2023.2
|
||||||
PKG_RELEASE:=5
|
PKG_RELEASE:=1
|
||||||
|
|
||||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||||
PKG_SOURCE_URL:=https://codeload.github.com/domoticz/domoticz/tar.gz/$(PKG_VERSION)?
|
PKG_SOURCE_URL:=https://codeload.github.com/domoticz/domoticz/tar.gz/$(PKG_VERSION)?
|
||||||
PKG_HASH:=8282cb71c924b6ef92503976d50f966f2c785eab8f8cffa1136ac133f0241157
|
PKG_HASH:=32bcf49df8c80c470352e63004a82d9601b90ccf406096099656250a4515ac28
|
||||||
|
|
||||||
PKG_MAINTAINER:=David Woodhouse <dwmw2@infradead.org>
|
PKG_MAINTAINER:=David Woodhouse <dwmw2@infradead.org>
|
||||||
PKG_LICENSE:=GPL-3.0
|
PKG_LICENSE:=GPL-3.0
|
||||||
|
|
|
@ -1,29 +0,0 @@
|
||||||
From 2975b1113d9540f39b6bade3b6d459b61c2e5007 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Arjen de Korte <build+github@de-korte.org>
|
|
||||||
Date: Sun, 15 May 2022 19:00:02 +0200
|
|
||||||
Subject: [PATCH] Fix compilation with GCC12
|
|
||||||
|
|
||||||
Building domoticz fails under GCC12 with the following error:
|
|
||||||
|
|
||||||
In file included from /usr/include/c++/12/utility:68,
|
|
||||||
from /home/abuild/rpmbuild/BUILD/domoticz-2022.1/main/LuaTable.cpp:10:
|
|
||||||
/usr/include/c++/12/bits/stl_relops.h:86:5: error: template with C linkage
|
|
||||||
86 | template <class _Tp>
|
|
||||||
| ^~~~~~~~
|
|
||||||
---
|
|
||||||
main/LuaTable.cpp | 2 +-
|
|
||||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
||||||
|
|
||||||
--- a/main/LuaTable.cpp
|
|
||||||
+++ b/main/LuaTable.cpp
|
|
||||||
@@ -6,9 +6,9 @@ extern "C" {
|
|
||||||
#include <lua.h>
|
|
||||||
#include <lualib.h>
|
|
||||||
#include <lauxlib.h>
|
|
||||||
+}
|
|
||||||
|
|
||||||
#include <utility>
|
|
||||||
-}
|
|
||||||
|
|
||||||
CLuaTable::CLuaTable(lua_State *lua_state, const std::string &Name)
|
|
||||||
{
|
|
|
@ -1,41 +0,0 @@
|
||||||
From 3c23a7863c0b01273d4c36423769443ea7e4a7bb Mon Sep 17 00:00:00 2001
|
|
||||||
From: David Woodhouse <dwmw2@infradead.org>
|
|
||||||
Date: Fri, 5 Jun 2020 15:02:41 +0100
|
|
||||||
Subject: [PATCH 1/2] unzip: reduce file name size to 65535 to work with
|
|
||||||
external minizip
|
|
||||||
MIME-Version: 1.0
|
|
||||||
Content-Type: text/plain; charset=UTF-8
|
|
||||||
Content-Transfer-Encoding: 8bit
|
|
||||||
|
|
||||||
The external minizip project has changed the unzGetCurrentFileInfo()
|
|
||||||
function to take a uint16_t as the filename size, instead of a uLong
|
|
||||||
as in the original version in zlib.
|
|
||||||
|
|
||||||
(Reported as https://github.com/nmoinvaz/minizip/issues/490 but it
|
|
||||||
was 3½ years ago and might be too late to fix it now, although changing
|
|
||||||
it back to a *larger* type is a lot safer than reducing the size, and
|
|
||||||
perhaps they should.)
|
|
||||||
|
|
||||||
This means that our 65536-byte buffer gets truncated to zero, as the
|
|
||||||
compiler tells us when we build agaisnt the external minizip:
|
|
||||||
|
|
||||||
domoticz/main/unzip_stream.h:140:50: warning: conversion from ‘long unsigned int’ to ‘uint16_t’ {aka ‘short unsigned int’} changes value from ‘65536’ to ‘0’ [-Woverflow]
|
|
||||||
140 | unzGetCurrentFileInfo(handler_, &info, path, sizeof(path), NULL, 0, NULL, 0);
|
|
||||||
| ^~~~~~~~~~~~
|
|
||||||
|
|
||||||
Reduce the buffer size to 65535 bytes instead.
|
|
||||||
---
|
|
||||||
main/unzip_stream.h | 2 +-
|
|
||||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
||||||
|
|
||||||
--- a/main/unzip_stream.h
|
|
||||||
+++ b/main/unzip_stream.h
|
|
||||||
@@ -143,7 +143,7 @@ namespace clx {
|
|
||||||
basic_unzip_stream& open(handler_type h) {
|
|
||||||
handler_ = h;
|
|
||||||
if (handler_) {
|
|
||||||
- char path[65536];
|
|
||||||
+ char path[65535];
|
|
||||||
unz_file_info info;
|
|
||||||
unzGetCurrentFileInfo(handler_, &info, path, sizeof(path), NULL, 0, NULL, 0);
|
|
||||||
path_ = path;
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,175 +0,0 @@
|
||||||
From a9df45497dc79023ed1864dd9b8e435935220171 Mon Sep 17 00:00:00 2001
|
|
||||||
From: dnpwwo <kendel.boul@gmail.com>
|
|
||||||
Date: Tue, 1 Mar 2022 13:09:01 +1100
|
|
||||||
Subject: [PATCH] BugFix: Linux crash when formating Python exceptions Other:
|
|
||||||
Continue code cleanup
|
|
||||||
|
|
||||||
---
|
|
||||||
hardware/plugins/Plugins.cpp | 45 +++++++++++-------------------------
|
|
||||||
hardware/plugins/Plugins.h | 3 ++-
|
|
||||||
main/EventsPythonModule.cpp | 6 ++---
|
|
||||||
3 files changed, 18 insertions(+), 36 deletions(-)
|
|
||||||
|
|
||||||
--- a/hardware/plugins/Plugins.cpp
|
|
||||||
+++ b/hardware/plugins/Plugins.cpp
|
|
||||||
@@ -724,13 +724,7 @@ namespace Plugins
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
- std::string sTypeText("Unknown");
|
|
||||||
- if (pExcept)
|
|
||||||
- {
|
|
||||||
- PyTypeObject* TypeName = (PyTypeObject*)pExcept;
|
|
||||||
- PyNewRef pName = PyObject_GetAttrString((PyObject*)TypeName, "__name__");
|
|
||||||
- sTypeText = (std::string)pName;
|
|
||||||
- }
|
|
||||||
+ std::string sTypeText("Unknown Error");
|
|
||||||
|
|
||||||
/* See if we can get a full traceback */
|
|
||||||
PyNewRef pModule = PyImport_ImportModule("traceback");
|
|
||||||
@@ -738,7 +732,7 @@ namespace Plugins
|
|
||||||
{
|
|
||||||
PyNewRef pFunc = PyObject_GetAttrString(pModule, "format_exception");
|
|
||||||
if (pFunc && PyCallable_Check(pFunc)) {
|
|
||||||
- PyNewRef pList = PyObject_CallFunctionObjArgs(pFunc, pExcept, pValue, pTraceback, NULL);
|
|
||||||
+ PyNewRef pList = PyObject_CallFunctionObjArgs(pFunc, (PyObject*)pExcept, (PyObject*)pValue, (PyObject*)pTraceback, NULL);
|
|
||||||
if (pList)
|
|
||||||
{
|
|
||||||
for (Py_ssize_t i = 0; i < PyList_Size(pList); i++)
|
|
||||||
@@ -756,16 +750,19 @@ namespace Plugins
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
+ if (pExcept) sTypeText = pExcept.Attribute("__name__");
|
|
||||||
Log(LOG_ERROR, "Exception: '%s'. No traceback available.", sTypeText.c_str());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
+ if (pExcept) sTypeText = pExcept.Attribute("__name__");
|
|
||||||
Log(LOG_ERROR, "'format_exception' lookup failed, exception: '%s'. No traceback available.", sTypeText.c_str());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
+ if (pExcept) sTypeText = pExcept.Attribute("__name__");
|
|
||||||
Log(LOG_ERROR, "'Traceback' module import failed, exception: '%s'. No traceback available.", sTypeText.c_str());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1950,7 +1947,7 @@ namespace Plugins
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
- void CPlugin::Callback(PyObject *pTarget, const std::string &sHandler, PyObject *pParams)
|
|
||||||
+ void CPlugin::Callback(PyBorrowedRef& pTarget, const std::string &sHandler, PyObject *pParams)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
@@ -1966,19 +1963,8 @@ namespace Plugins
|
|
||||||
PyNewRef pFunc = PyObject_GetAttrString(pTarget, sHandler.c_str());
|
|
||||||
if (pFunc && PyCallable_Check(pFunc))
|
|
||||||
{
|
|
||||||
- module_state *pModState = nullptr;
|
|
||||||
- PyBorrowedRef brModule = PyState_FindModule(&DomoticzModuleDef);
|
|
||||||
- if (!brModule)
|
|
||||||
- {
|
|
||||||
- brModule = PyState_FindModule(&DomoticzExModuleDef);
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- if (brModule)
|
|
||||||
- {
|
|
||||||
- pModState = ((struct module_state *)PyModule_GetState(brModule));
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
// Store the callback object so the Dump function has context if invoked
|
|
||||||
+ module_state* pModState = FindModule();
|
|
||||||
if (pModState)
|
|
||||||
{
|
|
||||||
pModState->lastCallback = pTarget;
|
|
||||||
@@ -1986,14 +1972,12 @@ namespace Plugins
|
|
||||||
|
|
||||||
if (m_bDebug & PDM_QUEUE)
|
|
||||||
{
|
|
||||||
- PyNewRef pName = PyObject_GetAttrString((PyObject*)(pTarget->ob_type), "__name__");
|
|
||||||
- if (pName)
|
|
||||||
- Log(LOG_NORM, "Calling message handler '%s' on '%s' type object.", sHandler.c_str(), (std::string(pName).c_str()));
|
|
||||||
+ Log(LOG_NORM, "Calling message handler '%s' on '%s' type object.", sHandler.c_str(), pTarget.Type().c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
PyErr_Clear();
|
|
||||||
|
|
||||||
- // Invokde the callback function
|
|
||||||
+ // Invoke the callback function
|
|
||||||
PyNewRef pReturnValue = PyObject_CallObject(pFunc, pParams);
|
|
||||||
|
|
||||||
if (pModState)
|
|
||||||
@@ -2020,17 +2004,14 @@ namespace Plugins
|
|
||||||
std::string sAttrName = pItem;
|
|
||||||
if (sAttrName.substr(0, 2) != "__") // ignore system stuff
|
|
||||||
{
|
|
||||||
- if (PyObject_HasAttrString(pTarget, sAttrName.c_str()))
|
|
||||||
+ std::string strValue = pTarget.Attribute(sAttrName);
|
|
||||||
+ if (strValue.length())
|
|
||||||
{
|
|
||||||
PyNewRef pValue = PyObject_GetAttrString(pTarget, sAttrName.c_str());
|
|
||||||
if (!PyCallable_Check(pValue)) // Filter out methods
|
|
||||||
{
|
|
||||||
- std::string strValue = pValue;
|
|
||||||
- if (strValue.length())
|
|
||||||
- {
|
|
||||||
- std::string sBlank((sAttrName.length() < 20) ? 20 - sAttrName.length() : 0, ' ');
|
|
||||||
- Log(LOG_NORM, " ----> '%s'%s '%s'", sAttrName.c_str(), sBlank.c_str(), strValue.c_str());
|
|
||||||
- }
|
|
||||||
+ std::string sBlank((sAttrName.length() < 20) ? 20 - sAttrName.length() : 0, ' ');
|
|
||||||
+ Log(LOG_NORM, " ----> '%s'%s '%s'", sAttrName.c_str(), sBlank.c_str(), strValue.c_str());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
--- a/hardware/plugins/Plugins.h
|
|
||||||
+++ b/hardware/plugins/Plugins.h
|
|
||||||
@@ -92,7 +92,7 @@ namespace Plugins {
|
|
||||||
void ConnectionWrite(CDirectiveBase *);
|
|
||||||
void ConnectionDisconnect(CDirectiveBase *);
|
|
||||||
void DisconnectEvent(CEventBase *);
|
|
||||||
- void Callback(PyObject* pTarget, const std::string &sHandler, PyObject *pParams);
|
|
||||||
+ void Callback(PyBorrowedRef& pTarget, const std::string &sHandler, PyObject *pParams);
|
|
||||||
void RestoreThread();
|
|
||||||
void ReleaseThread();
|
|
||||||
void Stop();
|
|
||||||
@@ -157,6 +157,7 @@ namespace Plugins {
|
|
||||||
m_pObject = pObject;
|
|
||||||
};
|
|
||||||
std::string Attribute(const char* name);
|
|
||||||
+ std::string Attribute(std::string& name) { return Attribute(name.c_str()); };
|
|
||||||
std::string Type();
|
|
||||||
bool IsDict() { return TypeCheck(Py_TPFLAGS_DICT_SUBCLASS); };
|
|
||||||
bool IsList() { return TypeCheck(Py_TPFLAGS_LIST_SUBCLASS); };
|
|
||||||
--- a/main/EventsPythonModule.cpp
|
|
||||||
+++ b/main/EventsPythonModule.cpp
|
|
||||||
@@ -297,7 +297,7 @@ namespace Plugins
|
|
||||||
PyBorrowedRef pModule = PythonEventsGetModule();
|
|
||||||
if (pModule)
|
|
||||||
{
|
|
||||||
- PyBorrowedRef pModuleDict = Plugins::PyModule_GetDict(pModule);
|
|
||||||
+ PyBorrowedRef pModuleDict = PyModule_GetDict(pModule);
|
|
||||||
if (!pModuleDict)
|
|
||||||
{
|
|
||||||
_log.Log(LOG_ERROR, "Python EventSystem: Failed to open module dictionary.");
|
|
||||||
@@ -312,7 +312,7 @@ namespace Plugins
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
- PyNewRef pDeviceDict = Plugins::PyDict_New();
|
|
||||||
+ PyNewRef pDeviceDict = PyDict_New();
|
|
||||||
if (PyDict_SetItemString(pModuleDict, "Devices", pDeviceDict) == -1)
|
|
||||||
{
|
|
||||||
_log.Log(LOG_ERROR, "Python EventSystem: Failed to add Device dictionary.");
|
|
||||||
@@ -320,7 +320,7 @@ namespace Plugins
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
- if (PyType_Ready((PyTypeObject*)Plugins::PDeviceType) < 0)
|
|
||||||
+ if (PyType_Ready((PyTypeObject*)PDeviceType) < 0)
|
|
||||||
{
|
|
||||||
_log.Log(LOG_ERROR, "Python EventSystem: Unable to ready DeviceType Object.");
|
|
||||||
PyEval_SaveThread();
|
|
|
@ -1,224 +0,0 @@
|
||||||
From 90e683a16ec1f267d3efd1b3fd1bff0b9ac9691e Mon Sep 17 00:00:00 2001
|
|
||||||
From: dnpwwo <kendel.boul@gmail.com>
|
|
||||||
Date: Tue, 1 Mar 2022 22:01:14 +1100
|
|
||||||
Subject: [PATCH] BugFix: Prevent crash processing Python exceptions on Linux.
|
|
||||||
Uplift: Create Device objects using Python rather than C++
|
|
||||||
|
|
||||||
---
|
|
||||||
main/EventsPythonDevice.h | 2 +-
|
|
||||||
main/EventsPythonModule.cpp | 92 ++++++++++++++++---------------------
|
|
||||||
2 files changed, 40 insertions(+), 54 deletions(-)
|
|
||||||
|
|
||||||
--- a/main/EventsPythonDevice.h
|
|
||||||
+++ b/main/EventsPythonDevice.h
|
|
||||||
@@ -55,6 +55,6 @@
|
|
||||||
nullptr,
|
|
||||||
nullptr };
|
|
||||||
|
|
||||||
- static PyObject* PDeviceType;
|
|
||||||
+ static PyTypeObject* PDeviceType;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
--- a/main/EventsPythonModule.cpp
|
|
||||||
+++ b/main/EventsPythonModule.cpp
|
|
||||||
@@ -16,11 +16,11 @@ namespace Plugins
|
|
||||||
{
|
|
||||||
#define GETSTATE(m) ((struct eventModule_state*)PyModule_GetState(m))
|
|
||||||
|
|
||||||
- void* m_PyInterpreter;
|
|
||||||
- bool ModuleInitialized = false;
|
|
||||||
+ PyThreadState* m_PyInterpreter;
|
|
||||||
+ bool m_ModuleInitialized = false;
|
|
||||||
|
|
||||||
struct eventModule_state {
|
|
||||||
- PyObject* error;
|
|
||||||
+ PyObject* error;
|
|
||||||
};
|
|
||||||
|
|
||||||
static PyMethodDef DomoticzEventsMethods[] = {
|
|
||||||
@@ -116,7 +116,7 @@ namespace Plugins
|
|
||||||
PyType_Spec PDeviceSpec = { "DomoticzEvents.PDevice", sizeof(PDevice), 0,
|
|
||||||
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, PDeviceSlots };
|
|
||||||
|
|
||||||
- PDeviceType = PyType_FromSpec(&PDeviceSpec);
|
|
||||||
+ PDeviceType = (PyTypeObject*)PyType_FromSpec(&PDeviceSpec);
|
|
||||||
PyModule_AddObject(pModule, "PDevice", (PyObject*)PDeviceType);
|
|
||||||
|
|
||||||
return pModule;
|
|
||||||
@@ -169,7 +169,7 @@ namespace Plugins
|
|
||||||
_log.Log(LOG_ERROR, "EventSystem - Python: Failed to initialize module.");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
- ModuleInitialized = true;
|
|
||||||
+ m_ModuleInitialized = true;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -232,12 +232,6 @@ namespace Plugins
|
|
||||||
else
|
|
||||||
{
|
|
||||||
std::string sTypeText("Unknown");
|
|
||||||
- if (pExcept)
|
|
||||||
- {
|
|
||||||
- PyTypeObject* TypeName = (PyTypeObject*)pExcept;
|
|
||||||
- PyNewRef pName = PyObject_GetAttrString((PyObject*)TypeName, "__name__");
|
|
||||||
- sTypeText = (std::string)pName;
|
|
||||||
- }
|
|
||||||
|
|
||||||
/* See if we can get a full traceback */
|
|
||||||
PyNewRef pModule = PyImport_ImportModule("traceback");
|
|
||||||
@@ -245,7 +239,7 @@ namespace Plugins
|
|
||||||
{
|
|
||||||
PyNewRef pFunc = PyObject_GetAttrString(pModule, "format_exception");
|
|
||||||
if (pFunc && PyCallable_Check(pFunc)) {
|
|
||||||
- PyNewRef pList = PyObject_CallFunctionObjArgs(pFunc, pExcept, pValue, pTraceback, NULL);
|
|
||||||
+ PyNewRef pList = PyObject_CallFunctionObjArgs(pFunc, (PyObject*)pExcept, (PyObject*)pValue, (PyObject*)pTraceback, NULL);
|
|
||||||
if (pList)
|
|
||||||
{
|
|
||||||
for (Py_ssize_t i = 0; i < PyList_Size(pList); i++)
|
|
||||||
@@ -263,16 +257,19 @@ namespace Plugins
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
+ if (pExcept) sTypeText = pExcept.Attribute("__name__");
|
|
||||||
_log.Log(LOG_ERROR, "Exception: '%s'. No traceback available.", sTypeText.c_str());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
+ if (pExcept) sTypeText = pExcept.Attribute("__name__");
|
|
||||||
_log.Log(LOG_ERROR, "'format_exception' lookup failed, exception: '%s'. No traceback available.", sTypeText.c_str());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
+ if (pExcept) sTypeText = pExcept.Attribute("__name__");
|
|
||||||
_log.Log(LOG_ERROR, "'Traceback' module import failed, exception: '%s'. No traceback available.", sTypeText.c_str());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -280,11 +277,11 @@ namespace Plugins
|
|
||||||
}
|
|
||||||
|
|
||||||
void PythonEventsProcessPython(const std::string &reason, const std::string &filename, const std::string &PyString,
|
|
||||||
- const uint64_t DeviceID, std::map<uint64_t, CEventSystem::_tDeviceStatus> m_devicestates,
|
|
||||||
- std::map<uint64_t, CEventSystem::_tUserVariable> m_uservariables, int intSunRise, int intSunSet)
|
|
||||||
+ const uint64_t DeviceID, std::map<uint64_t, CEventSystem::_tDeviceStatus> deviceStates,
|
|
||||||
+ std::map<uint64_t, CEventSystem::_tUserVariable> userVariables, int intSunRise, int intSunSet)
|
|
||||||
{
|
|
||||||
|
|
||||||
- if (!ModuleInitialized)
|
|
||||||
+ if (!m_ModuleInitialized)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
@@ -292,7 +289,7 @@ namespace Plugins
|
|
||||||
if (Py_IsInitialized())
|
|
||||||
{
|
|
||||||
if (m_PyInterpreter)
|
|
||||||
- PyEval_RestoreThread((PyThreadState *)m_PyInterpreter);
|
|
||||||
+ PyEval_RestoreThread(m_PyInterpreter);
|
|
||||||
|
|
||||||
PyBorrowedRef pModule = PythonEventsGetModule();
|
|
||||||
if (pModule)
|
|
||||||
@@ -305,7 +302,7 @@ namespace Plugins
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
- PyNewRef pStrVal = PyUnicode_FromString(m_devicestates[DeviceID].deviceName.c_str());
|
|
||||||
+ PyNewRef pStrVal = PyUnicode_FromString(deviceStates[DeviceID].deviceName.c_str());
|
|
||||||
if (PyDict_SetItemString(pModuleDict, "changed_device_name", pStrVal) == -1)
|
|
||||||
{
|
|
||||||
_log.Log(LOG_ERROR, "Python EventSystem: Failed to set changed_device_name.");
|
|
||||||
@@ -327,22 +324,34 @@ namespace Plugins
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
- // Mutex
|
|
||||||
- // boost::shared_lock<boost::shared_mutex> devicestatesMutexLock1(m_devicestatesMutex);
|
|
||||||
-
|
|
||||||
- for (auto it_type = m_devicestates.begin(); it_type != m_devicestates.end(); ++it_type)
|
|
||||||
+ for (auto it_type = deviceStates.begin(); it_type != deviceStates.end(); ++it_type)
|
|
||||||
{
|
|
||||||
CEventSystem::_tDeviceStatus sitem = it_type->second;
|
|
||||||
- // object deviceStatus = domoticz_module.attr("Device")(sitem.ID, sitem.deviceName, sitem.devType,
|
|
||||||
- // sitem.subType, sitem.switchtype, sitem.nValue, sitem.nValueWording, sitem.sValue,
|
|
||||||
- // sitem.lastUpdate); devices[sitem.deviceName] = deviceStatus;
|
|
||||||
|
|
||||||
- PDevice *aDevice = (PDevice *)PDevice_new((PyTypeObject*)PDeviceType, (PyObject *)nullptr, (PyObject *)nullptr);
|
|
||||||
- PyNewRef pKey = PyUnicode_FromString(sitem.deviceName.c_str());
|
|
||||||
+ PyNewRef nrArgList = Py_BuildValue("(iOiiiOiOO)", static_cast<int>(sitem.ID),
|
|
||||||
+ PyUnicode_FromString(sitem.deviceName.c_str()),
|
|
||||||
+ sitem.devType,
|
|
||||||
+ sitem.subType,
|
|
||||||
+ sitem.switchtype,
|
|
||||||
+ PyUnicode_FromString(sitem.sValue.c_str()),
|
|
||||||
+ sitem.nValue,
|
|
||||||
+ PyUnicode_FromString(sitem.nValueWording.c_str()),
|
|
||||||
+ PyUnicode_FromString(sitem.lastUpdate.c_str()));
|
|
||||||
+ if (!nrArgList)
|
|
||||||
+ {
|
|
||||||
+ _log.Log(LOG_ERROR, "Python EventSystem: Building device argument list failed for key %s.", sitem.deviceName.c_str());
|
|
||||||
+ continue;
|
|
||||||
+ }
|
|
||||||
+ PyNewRef pDevice = PyObject_CallObject((PyObject*)PDeviceType, nrArgList);
|
|
||||||
+ if (!pDevice)
|
|
||||||
+ {
|
|
||||||
+ _log.Log(LOG_ERROR, "Python EventSystem: Event Device object creation failed for key %s.", sitem.deviceName.c_str());
|
|
||||||
+ continue;
|
|
||||||
+ }
|
|
||||||
|
|
||||||
if (sitem.ID == DeviceID)
|
|
||||||
{
|
|
||||||
- if (PyDict_SetItemString(pModuleDict, "changed_device", (PyObject *)aDevice) == -1)
|
|
||||||
+ if (PyDict_SetItemString(pModuleDict, "changed_device", (PyObject *)pDevice) == -1)
|
|
||||||
{
|
|
||||||
_log.Log(LOG_ERROR,
|
|
||||||
"Python EventSystem: Failed to add device '%s' as changed_device.",
|
|
||||||
@@ -350,36 +359,13 @@ namespace Plugins
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
- if (PyDict_SetItem(pDeviceDict, pKey, (PyObject *)aDevice) == -1)
|
|
||||||
+ PyNewRef pKey = PyUnicode_FromString(sitem.deviceName.c_str());
|
|
||||||
+ if (PyDict_SetItem(pDeviceDict, pKey, (PyObject *)pDevice) == -1)
|
|
||||||
{
|
|
||||||
_log.Log(LOG_ERROR, "Python EventSystem: Failed to add device '%s' to device dictionary.",
|
|
||||||
sitem.deviceName.c_str());
|
|
||||||
}
|
|
||||||
- else
|
|
||||||
- {
|
|
||||||
-
|
|
||||||
- // _log.Log(LOG_ERROR, "Python EventSystem: nValueWording '%s' - done. ",
|
|
||||||
- // sitem.nValueWording.c_str());
|
|
||||||
-
|
|
||||||
- std::string temp_n_value_string = sitem.nValueWording;
|
|
||||||
-
|
|
||||||
- // If nValueWording contains %, unicode fails?
|
|
||||||
-
|
|
||||||
- aDevice->id = static_cast<int>(sitem.ID);
|
|
||||||
- aDevice->name = PyUnicode_FromString(sitem.deviceName.c_str());
|
|
||||||
- aDevice->type = sitem.devType;
|
|
||||||
- aDevice->sub_type = sitem.subType;
|
|
||||||
- aDevice->switch_type = sitem.switchtype;
|
|
||||||
- aDevice->n_value = sitem.nValue;
|
|
||||||
- aDevice->n_value_string = PyUnicode_FromString(temp_n_value_string.c_str());
|
|
||||||
- aDevice->s_value = Plugins::PyUnicode_FromString(sitem.sValue.c_str());
|
|
||||||
- aDevice->last_update_string = PyUnicode_FromString(sitem.lastUpdate.c_str());
|
|
||||||
- // _log.Log(LOG_STATUS, "Python EventSystem: deviceName %s added to device dictionary",
|
|
||||||
- // sitem.deviceName.c_str());
|
|
||||||
- }
|
|
||||||
- Py_DECREF(aDevice);
|
|
||||||
}
|
|
||||||
- // devicestatesMutexLock1.unlock();
|
|
||||||
|
|
||||||
// Time related
|
|
||||||
|
|
||||||
@@ -440,7 +426,7 @@ namespace Plugins
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
- for (auto it_var = m_uservariables.begin(); it_var != m_uservariables.end(); ++it_var)
|
|
||||||
+ for (auto it_var = userVariables.begin(); it_var != userVariables.end(); ++it_var)
|
|
||||||
{
|
|
||||||
CEventSystem::_tUserVariable uvitem = it_var->second;
|
|
||||||
PyDict_SetItemString(userVariablesDict, uvitem.variableName.c_str(),
|
|
|
@ -1,23 +0,0 @@
|
||||||
From fff4bef553cfd75030d473b3296ade88b3150909 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Rob Peters <Info@Domoticz.com>
|
|
||||||
Date: Thu, 10 Mar 2022 07:09:18 +0100
|
|
||||||
Subject: [PATCH] Fixed compile error when PYTHON was disabled (Fixes #5187)
|
|
||||||
|
|
||||||
---
|
|
||||||
hardware/plugins/DelayedLink.h | 3 ++-
|
|
||||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
|
||||||
|
|
||||||
--- a/hardware/plugins/DelayedLink.h
|
|
||||||
+++ b/hardware/plugins/DelayedLink.h
|
|
||||||
@@ -1,5 +1,5 @@
|
|
||||||
#pragma once
|
|
||||||
-
|
|
||||||
+#ifdef ENABLE_PYTHON
|
|
||||||
#ifdef WIN32
|
|
||||||
# define MS_NO_COREDLL 1
|
|
||||||
#else
|
|
||||||
@@ -574,3 +574,4 @@ static inline void py3__Py_XDECREF(PyObj
|
|
||||||
#endif
|
|
||||||
#pragma pop_macro("_DEBUG")
|
|
||||||
} // namespace Plugins
|
|
||||||
+#endif //#ifdef ENABLE_PYTHON
|
|
|
@ -1,33 +0,0 @@
|
||||||
From ca4578980e373543d0561564863718c879fa7743 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Rob Peters <Info@Domoticz.com>
|
|
||||||
Date: Thu, 10 Mar 2022 12:32:29 +0100
|
|
||||||
Subject: [PATCH] Making sure code can be compiled without Python
|
|
||||||
|
|
||||||
---
|
|
||||||
hardware/plugins/Plugins.h | 4 ++++
|
|
||||||
hardware/plugins/PythonObjects.h | 1 +
|
|
||||||
2 files changed, 5 insertions(+)
|
|
||||||
|
|
||||||
--- a/hardware/plugins/Plugins.h
|
|
||||||
+++ b/hardware/plugins/Plugins.h
|
|
||||||
@@ -1,5 +1,7 @@
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
+#ifdef ENABLE_PYTHON
|
|
||||||
+
|
|
||||||
#include "../DomoticzHardware.h"
|
|
||||||
#include "../hardwaretypes.h"
|
|
||||||
#include "../../notifications/NotificationBase.h"
|
|
||||||
@@ -300,3 +302,5 @@ namespace Plugins {
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace Plugins
|
|
||||||
+
|
|
||||||
+#endif //#ifdef ENABLE_PYTHON
|
|
||||||
--- a/hardware/plugins/PythonObjects.h
|
|
||||||
+++ b/hardware/plugins/PythonObjects.h
|
|
||||||
@@ -169,3 +169,4 @@ namespace Plugins {
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace Plugins
|
|
||||||
+
|
|
Loading…
Reference in a new issue