* [PATCH] dbus: Use GLib.MainLoop()
@ 2021-07-28 16:59 Petr Lautrbach
2021-07-30 14:22 ` James Carter
0 siblings, 1 reply; 3+ messages in thread
From: Petr Lautrbach @ 2021-07-28 16:59 UTC (permalink / raw)
To: selinux; +Cc: Petr Lautrbach
Fixes:
PyGIDeprecationWarning: GObject.MainLoop is deprecated; use GLib.MainLoop instead
Signed-off-by: Petr Lautrbach <plautrba@redhat.com>
---
dbus/selinux_server.py | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/dbus/selinux_server.py b/dbus/selinux_server.py
index b7c9378bcb5d..a969f2268ceb 100644
--- a/dbus/selinux_server.py
+++ b/dbus/selinux_server.py
@@ -2,8 +2,9 @@
import dbus
import dbus.service
-import dbus.mainloop.glib
+from dbus.mainloop.glib import DBusGMainLoop
from gi.repository import GObject
+from gi.repository import GLib
import os
import selinux
from subprocess import Popen, PIPE, STDOUT
@@ -145,9 +146,10 @@ class selinux_server(dbus.service.Object):
raise ValueError("%s does not exist" % path)
if __name__ == "__main__":
- mainloop = GObject.MainLoop()
- dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
+ DBusGMainLoop(set_as_default=True)
+ mainloop = GLib.MainLoop()
+
system_bus = dbus.SystemBus()
name = dbus.service.BusName("org.selinux", system_bus)
- object = selinux_server(system_bus, "/org/selinux/object")
+ server = selinux_server(system_bus, "/org/selinux/object")
mainloop.run()
--
2.32.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] dbus: Use GLib.MainLoop()
2021-07-28 16:59 [PATCH] dbus: Use GLib.MainLoop() Petr Lautrbach
@ 2021-07-30 14:22 ` James Carter
2021-08-03 14:04 ` James Carter
0 siblings, 1 reply; 3+ messages in thread
From: James Carter @ 2021-07-30 14:22 UTC (permalink / raw)
To: Petr Lautrbach; +Cc: SElinux list
On Wed, Jul 28, 2021 at 12:59 PM Petr Lautrbach <plautrba@redhat.com> wrote:
>
> Fixes:
> PyGIDeprecationWarning: GObject.MainLoop is deprecated; use GLib.MainLoop instead
>
> Signed-off-by: Petr Lautrbach <plautrba@redhat.com>
In trying to test this, selinux_server.py seems to work and be waiting
to respond, but selinux_client.py just immediately exits with the
error "org.freedesktop.PolicyKit1.Error.Failed: Action
org.selinux.customized is not registered". I am probably doing
something wrong.
At any rate, this definitely fixes the error.
Acked-by: James Carter <jwcart2@gmail.com>
> ---
> dbus/selinux_server.py | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/dbus/selinux_server.py b/dbus/selinux_server.py
> index b7c9378bcb5d..a969f2268ceb 100644
> --- a/dbus/selinux_server.py
> +++ b/dbus/selinux_server.py
> @@ -2,8 +2,9 @@
>
> import dbus
> import dbus.service
> -import dbus.mainloop.glib
> +from dbus.mainloop.glib import DBusGMainLoop
> from gi.repository import GObject
> +from gi.repository import GLib
> import os
> import selinux
> from subprocess import Popen, PIPE, STDOUT
> @@ -145,9 +146,10 @@ class selinux_server(dbus.service.Object):
> raise ValueError("%s does not exist" % path)
>
> if __name__ == "__main__":
> - mainloop = GObject.MainLoop()
> - dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
> + DBusGMainLoop(set_as_default=True)
> + mainloop = GLib.MainLoop()
> +
> system_bus = dbus.SystemBus()
> name = dbus.service.BusName("org.selinux", system_bus)
> - object = selinux_server(system_bus, "/org/selinux/object")
> + server = selinux_server(system_bus, "/org/selinux/object")
> mainloop.run()
> --
> 2.32.0
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] dbus: Use GLib.MainLoop()
2021-07-30 14:22 ` James Carter
@ 2021-08-03 14:04 ` James Carter
0 siblings, 0 replies; 3+ messages in thread
From: James Carter @ 2021-08-03 14:04 UTC (permalink / raw)
To: Petr Lautrbach; +Cc: SElinux list
On Fri, Jul 30, 2021 at 10:22 AM James Carter <jwcart2@gmail.com> wrote:
>
> On Wed, Jul 28, 2021 at 12:59 PM Petr Lautrbach <plautrba@redhat.com> wrote:
> >
> > Fixes:
> > PyGIDeprecationWarning: GObject.MainLoop is deprecated; use GLib.MainLoop instead
> >
> > Signed-off-by: Petr Lautrbach <plautrba@redhat.com>
>
> In trying to test this, selinux_server.py seems to work and be waiting
> to respond, but selinux_client.py just immediately exits with the
> error "org.freedesktop.PolicyKit1.Error.Failed: Action
> org.selinux.customized is not registered". I am probably doing
> something wrong.
>
> At any rate, this definitely fixes the error.
>
> Acked-by: James Carter <jwcart2@gmail.com>
>
Merged.
Thanks,
Jim
> > ---
> > dbus/selinux_server.py | 10 ++++++----
> > 1 file changed, 6 insertions(+), 4 deletions(-)
> >
> > diff --git a/dbus/selinux_server.py b/dbus/selinux_server.py
> > index b7c9378bcb5d..a969f2268ceb 100644
> > --- a/dbus/selinux_server.py
> > +++ b/dbus/selinux_server.py
> > @@ -2,8 +2,9 @@
> >
> > import dbus
> > import dbus.service
> > -import dbus.mainloop.glib
> > +from dbus.mainloop.glib import DBusGMainLoop
> > from gi.repository import GObject
> > +from gi.repository import GLib
> > import os
> > import selinux
> > from subprocess import Popen, PIPE, STDOUT
> > @@ -145,9 +146,10 @@ class selinux_server(dbus.service.Object):
> > raise ValueError("%s does not exist" % path)
> >
> > if __name__ == "__main__":
> > - mainloop = GObject.MainLoop()
> > - dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
> > + DBusGMainLoop(set_as_default=True)
> > + mainloop = GLib.MainLoop()
> > +
> > system_bus = dbus.SystemBus()
> > name = dbus.service.BusName("org.selinux", system_bus)
> > - object = selinux_server(system_bus, "/org/selinux/object")
> > + server = selinux_server(system_bus, "/org/selinux/object")
> > mainloop.run()
> > --
> > 2.32.0
> >
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-08-03 14:04 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-28 16:59 [PATCH] dbus: Use GLib.MainLoop() Petr Lautrbach
2021-07-30 14:22 ` James Carter
2021-08-03 14:04 ` James Carter
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.