From 5af30127d656fe6e1bc33f0a691f4653fbffa2256e7ab47c3963302941c4ded3 Mon Sep 17 00:00:00 2001 From: "Dr. Werner Fink" Date: Wed, 29 Jan 2020 13:18:19 +0000 Subject: [PATCH] Accepting request 768309 from home:WernerFink:Factory - First try to port pam_dbus to python3 OBS-URL: https://build.opensuse.org/request/show/768309 OBS-URL: https://build.opensuse.org/package/show/Linux-PAM/pam_dbus?expand=0&rev=5 --- pam_dbus.changes | 5 ++++ pam_dbus.spec | 10 +++++--- py3port.patch | 63 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 74 insertions(+), 4 deletions(-) create mode 100644 py3port.patch diff --git a/pam_dbus.changes b/pam_dbus.changes index 984bfd6..89e7a97 100644 --- a/pam_dbus.changes +++ b/pam_dbus.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Wed Jan 29 12:52:19 UTC 2020 - Dr. Werner Fink + +- First try to port pam_dbus to python3 + ------------------------------------------------------------------- Tue Jul 25 00:48:26 UTC 2017 - jengelh@inai.de diff --git a/pam_dbus.spec b/pam_dbus.spec index 9ae33a4..4ff2bea 100644 --- a/pam_dbus.spec +++ b/pam_dbus.spec @@ -27,6 +27,7 @@ Source0: http://git.nomeata.de/?p=darcs-mirror-pam-dbus.debian.git;a=snap Source1: pam_dbus.8 Source2: pam_dbus-rpmlintrc Patch0: pam_dbus-0.2.1.3.dif +Patch1: py3port.patch BuildRequires: autoconf BuildRequires: automake BuildRequires: dbus-1-devel @@ -34,12 +35,12 @@ BuildRequires: dbus-1-glib-devel BuildRequires: dbus-1-python BuildRequires: gcc-c++ BuildRequires: glib2-devel +BuildRequires: gobject-introspection BuildRequires: libtool BuildRequires: pam-devel -Requires: python -Requires: python-base -Requires: python-gtk -Requires: python-notify +Requires: python3 +Requires: python3-base +Requires: python3-notify2 BuildRoot: %{_tmppath}/%{name}-%{version}-build %description @@ -51,6 +52,7 @@ in (typically local) user to accept or deny the authentication request. test -h %{name}-%{version} || ln -sf darcs-mirror-pam-dbus.debian-%{commit} %{name}-%{version} %setup -q -D %patch0 +%patch1 sed -ri '/^PAM_MODDIR/{ s@/lib/@/%{_lib}/@p }' configure.ac autoreconf -fis diff --git a/py3port.patch b/py3port.patch new file mode 100644 index 0000000..062b8cb --- /dev/null +++ b/py3port.patch @@ -0,0 +1,63 @@ +--- + handlers/pam-dbus-notify | 22 ++++++++++++---------- + 1 file changed, 12 insertions(+), 10 deletions(-) + +--- handlers/pam-dbus-notify 2014-01-15 00:36:52.000000000 +0100 ++++ handlers/pam-dbus-notify 2020-01-29 12:53:20.116433175 +0100 +@@ -1,14 +1,16 @@ +-#!/usr/bin/python ++#!/usr/bin/python3 + +-import pygtk +-import gtk +-import gobject ++import gi ++gi.require_version('Gtk', '3.0') ++from gi.repository import Gtk + + import dbus + import dbus.service +-import dbus.glib + +-import pynotify ++from dbus.mainloop.glib import DBusGMainLoop ++DBusGMainLoop(set_as_default=True) ++ ++import notify2 + + # list of Notifications around, kept to prevent the garbage collector to handle them. + ns = [] +@@ -23,7 +25,7 @@ def notify_cb(n, action, pam_cb): + ns.remove(n) + + # Initializite pynotify +-if not pynotify.init("pam-dbus"): ++if not notify2.init("pam-dbus"): + sys.exit(1) + + # dbus object to answer the request +@@ -36,7 +38,7 @@ class PamDbusAnswer(dbus.service.Object) + async_callbacks=('ret_cb', 'error_cb')) + def MayLogin(self, service, user, rhost, ruser, ret_cb, error_cb): + +- n = pynotify.Notification("Login request","Someone " + ++ n = notify2.Notification("Login request","Someone " + + ("named %s " % ruser if ruser else "") + + "tries to log in via %s " % service + + ("from %s " % rhost if rhost else "") + +@@ -49,7 +51,7 @@ class PamDbusAnswer(dbus.service.Object) + n.connect("closed",lambda n: notify_cb(n,"closed", ret_cb)) + + if not n.show(): +- print "Failed to send notification" ++ print("Failed to send notification") + sys.exit(1) + + ns.append(n) +@@ -58,5 +60,5 @@ system_bus = dbus.SystemBus() + name = dbus.service.BusName("de.nomeata.pam_dbus", bus=system_bus) + object = PamDbusAnswer(name) + +-gtk.main() ++Gtk.main() +