This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
pespin gerrit-no-reply at lists.osmocom.orgpespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-gsm-tester/+/18055 ) Change subject: ms_ofono: import pydbus and GLib modules on first use ...................................................................... ms_ofono: import pydbus and GLib modules on first use Change-Id: I754e1290eb5593c0ef168f74747f42db1b50f16c --- M src/osmo_gsm_tester/obj/ms_ofono.py 1 file changed, 26 insertions(+), 13 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-tester refs/changes/55/18055/1 diff --git a/src/osmo_gsm_tester/obj/ms_ofono.py b/src/osmo_gsm_tester/obj/ms_ofono.py index e03bab8..2598eee 100644 --- a/src/osmo_gsm_tester/obj/ms_ofono.py +++ b/src/osmo_gsm_tester/obj/ms_ofono.py @@ -17,21 +17,35 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. +import os + from ..core import log, util, process from ..core.event_loop import MainLoop from .ms import MS from . import sms -from pydbus import SystemBus, Variant -import os - -# Required for Gio.Cancellable. -# See https://lazka.github.io/pgi-docs/Gio-2.0/classes/Cancellable.html#Gio.Cancellable -from gi.module import get_introspection_module -Gio = get_introspection_module('Gio') - -from gi.repository import GLib +_import_external_modules_done = False bus = None +Gio = None +GLib = None +Variant = None +def _import_external_modules(): + global _import_external_modules_done, bus, Gio, GLib, Variant + if _import_external_modules_done: + return + _import_external_modules_done = True + + # Required for Gio.Cancellable. + # See https://lazka.github.io/pgi-docs/Gio-2.0/classes/Cancellable.html#Gio.Cancellable + from gi.module import get_introspection_module + Gio = get_introspection_module('Gio') + from gi.repository import GLib as glib_module + GLib = glib_module + + from pydbus import SystemBus, Variant + bus = SystemBus() + from pydbus import Variant as variant_class + Variant = variant_class I_MODEM = 'org.ofono.Modem' I_NETREG = 'org.ofono.NetworkRegistration' @@ -68,9 +82,6 @@ return DeferredDBus(dbus_iface, handler).subscription_id def systembus_get(path): - global bus - if not bus: - bus = SystemBus() return bus.get('org.ofono', path) def list_modems(): @@ -362,9 +373,11 @@ CTX_PROT_IPv46 = 'dual' def __init__(self, testenv, conf): + super().__init__('modem', conf) + _import_external_modules() self.syspath = conf.get('path') self.dbuspath = get_dbuspath_from_syspath(self.syspath) - super().__init__(self.dbuspath, conf) + self.set_name(self.dbuspath) self.dbg('creating from syspath %s' % self.syspath) self._ki = None self._imsi = None -- To view, visit https://gerrit.osmocom.org/c/osmo-gsm-tester/+/18055 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-gsm-tester Gerrit-Branch: master Gerrit-Change-Id: I754e1290eb5593c0ef168f74747f42db1b50f16c Gerrit-Change-Number: 18055 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin at sysmocom.de> Gerrit-MessageType: newchange -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200505/af661471/attachment.htm>