Bug#934743: python-networkmanager: org.freedesktop.DBus.Error.ServiceUnknown if NetworkManager service restarts

2019-08-14 Thread Ana Rodriguez Lopez
Package: python3-networkmanager
Version: 2.1-2
Tags: patch
Forwarded: https://github.com/seveas/python-networkmanager/issues/66

If NetworkManager service restarts, it gets a new dbus unix process id.
The python-networkmanager remains with the old id. since this process
doesn't exist any more, a org.freedesktop.DBus.Error.ServiceUnknown
exception is thrown.

The parameter follow_name_owner_changes can be used in get_object()
calls to prevent this.

diff --git a/NetworkManager.py b/NetworkManager.py
index 3d137fe..00f0729 100644
--- a/NetworkManager.py
+++ b/NetworkManager.py
@@ -258,7 +258,7 @@ def __eq__(self, other):
 @property
 def proxy(self):
 if not self._proxy:
-self._proxy =
dbus.SystemBus().get_object(self.dbus_service, self.object_path)
+self._proxy =
dbus.SystemBus().get_object(self.dbus_service, self.object_path,
follow_name_owner_changes=True)
 self._proxy.created = time.time()
 elif self._proxy.created < self.last_disconnect:
 if self.is_transient:


https://github.com/anrodlo/python-networkmanager/commit/88f1b0e4531f80e17af3ffe00b5816800ebb4c1a.diff



Bug#896281: Suggested patch for python-networkmanager

2018-08-23 Thread Ana Rodriguez Lopez
With the attached patch, it is possible to import the module without
dbus (e.g. in chroot).


Ana

From 1740799d3b710d640abc97a2b0cda2e5c9e23d6a Mon Sep 17 00:00:00 2001
From: Ana Rodriguez 
Date: Thu, 23 Aug 2018 13:15:34 +0200
Subject: [PATCH] See #57: gracefully handle dbus exception

---
 NetworkManager.py | 16 +++-
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/NetworkManager.py b/NetworkManager.py
index 28a0d0e..7301e00 100644
--- a/NetworkManager.py
+++ b/NetworkManager.py
@@ -96,7 +96,10 @@ SignalDispatcher = SignalDispatcher()
 # We completely dynamically generate all classes using introspection data. As
 # this is done at import time, use a special dbus connection that does not get
 # in the way of setting a mainloop and doing async stuff later.
-init_bus = dbus.SystemBus(private=True)
+try:
+init_bus = dbus.SystemBus(private=True)
+except dbus.exceptions.DBusException:
+init_bus = None
 xml_cache = {}
 
 class NMDbusInterfaceType(type):
@@ -129,9 +132,11 @@ class NMDbusInterfaceType(type):
 # If we know where to find this object, let's introspect it and
 # generate properties and methods
 if 'object_path' in attrs and attrs['object_path']:
-proxy = init_bus.get_object(type_.dbus_service, attrs['object_path'])
-attrs['introspection_data'] = proxy.Introspect(dbus_interface='org.freedesktop.DBus.Introspectable')
-root = etree.fromstring(attrs['introspection_data'])
+root = []
+if init_bus is not None:
+proxy = init_bus.get_object(type_.dbus_service, attrs['object_path'])
+attrs['introspection_data'] = proxy.Introspect(dbus_interface='org.freedesktop.DBus.Introspectable')
+root = etree.fromstring(attrs['introspection_data'])
 for element in root:
 if element.tag == 'interface' and element.attrib['name'] in attrs['interface_names']:
 for item in element:
@@ -711,7 +716,8 @@ class fixups(object):
 NetworkManager = NetworkManager()
 Settings = Settings()
 AgentManager = AgentManager()
-init_bus.close()
+if init_bus is not None:
+init_bus.close()
 del init_bus
 del xml_cache
 
-- 
2.18.0



signature.asc
Description: OpenPGP digital signature


Bug#896281: Suggested patch for python-networkmanager

2018-08-23 Thread Ana Rodriguez Lopez
With the attached patch, it is possible to import the module without
dbus (e.g. in chroot).


Ana

From 1740799d3b710d640abc97a2b0cda2e5c9e23d6a Mon Sep 17 00:00:00 2001
From: Ana Rodriguez 
Date: Thu, 23 Aug 2018 13:15:34 +0200
Subject: [PATCH] See #57: gracefully handle dbus exception

---
 NetworkManager.py | 16 +++-
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/NetworkManager.py b/NetworkManager.py
index 28a0d0e..7301e00 100644
--- a/NetworkManager.py
+++ b/NetworkManager.py
@@ -96,7 +96,10 @@ SignalDispatcher = SignalDispatcher()
 # We completely dynamically generate all classes using introspection data. As
 # this is done at import time, use a special dbus connection that does not get
 # in the way of setting a mainloop and doing async stuff later.
-init_bus = dbus.SystemBus(private=True)
+try:
+init_bus = dbus.SystemBus(private=True)
+except dbus.exceptions.DBusException:
+init_bus = None
 xml_cache = {}
 
 class NMDbusInterfaceType(type):
@@ -129,9 +132,11 @@ class NMDbusInterfaceType(type):
 # If we know where to find this object, let's introspect it and
 # generate properties and methods
 if 'object_path' in attrs and attrs['object_path']:
-proxy = init_bus.get_object(type_.dbus_service, attrs['object_path'])
-attrs['introspection_data'] = proxy.Introspect(dbus_interface='org.freedesktop.DBus.Introspectable')
-root = etree.fromstring(attrs['introspection_data'])
+root = []
+if init_bus is not None:
+proxy = init_bus.get_object(type_.dbus_service, attrs['object_path'])
+attrs['introspection_data'] = proxy.Introspect(dbus_interface='org.freedesktop.DBus.Introspectable')
+root = etree.fromstring(attrs['introspection_data'])
 for element in root:
 if element.tag == 'interface' and element.attrib['name'] in attrs['interface_names']:
 for item in element:
@@ -711,7 +716,8 @@ class fixups(object):
 NetworkManager = NetworkManager()
 Settings = Settings()
 AgentManager = AgentManager()
-init_bus.close()
+if init_bus is not None:
+init_bus.close()
 del init_bus
 del xml_cache
 
-- 
2.18.0



Bug#889039: python-networkmanager: python-networkmanager does not contain code

2018-02-01 Thread Ana Rodriguez Lopez
Package: python-networkmanager
Version: 2.0.1-1
Severity: normal

Dear maintainer,

I tried to build your package from the Debian git and the python2
version does not contain the actual code, only docs. I changed
debian/rules as follows:

diff --git a/debian/rules b/debian/rules
index bb8cca4..8a2fe95 100755
--- a/debian/rules
+++ b/debian/rules
@@ -1,24 +1,14 @@
 #!/usr/bin/make -f

-PYTHON2=$(shell pyversions -vr)
-PYTHON3=$(shell py3versions -vr)
+export PYBUILD_NAME=networkmanager

 %:
-   dh $@ --with python2,python3 --buildsystem=python_distutils
+   dh $@ --with python2,python3 --buildsystem=pybuild

-build-python%:
-   python$* setup.py build
-
-override_dh_auto_build: $(PYTHON3:%=build-python%)
+override_dh_auto_build:
dh_auto_build
make -C docs html

-install-python%:
-   python$* setup.py install --root=$(CURDIR)/debian/tmp
--install-layout=deb
-
-override_dh_auto_install: $(PYTHON3:%=install-python%)
-   dh_auto_install
-
 override_dh_auto_clean:
dh_auto_clean
make -C docs clean


And also removed debian/python3-networkmanager.install.


Thanks,
Ana



Bug#889034: python-networkmanager: License has changed to zlib

2018-02-01 Thread Ana Rodriguez Lopez
Package: python-networkmanager
Version: 2.0.1-1
Severity: normal

Dear maintainer,

upstream changed the license from GPL3+ to zlib on 2016-02-04 in commit
e9ba67a2e81f7a34e18cee2777925ab3c929b94d. Please update debian/changelog
accordingly.

Thanks,
Ana