commit 4475121bb7af07a68607fbc747f36b6c5f5cabd6
Author: Jakub Bogusz <qbo...@pld-linux.org>
Date:   Sun Jul 21 19:37:07 2024 +0200

    - new

 python-pam-py2.patch |  29 +++++++++++++++
 python-pam.spec      | 102 +++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 131 insertions(+)
---
diff --git a/python-pam.spec b/python-pam.spec
new file mode 100644
index 0000000..4afb841
--- /dev/null
+++ b/python-pam.spec
@@ -0,0 +1,102 @@
+#
+# Conditional build:
+%bcond_without python2 # CPython 2.x module
+%bcond_without python3 # CPython 3.x module
+
+Summary:       Python PAM module using ctypes
+Summary(pl.UTF-8):     Moduł PAM dla Pythona wykorzystujący ctypes
+Name:          python-pam
+Version:       2.0.2
+Release:       1
+License:       MIT
+Group:         Libraries/Python
+#Source0Download: https://pypi.org/simple/python-pam/
+Source0:       
https://files.pythonhosted.org/packages/source/p/python-pam/python-pam-%{version}.tar.gz
+# Source0-md5: 1ee6201b3a696d3e022d67643547496c
+Patch0:                %{name}-py2.patch
+URL:           https://pypi.org/project/python-pam/
+%if %{with python2}
+BuildRequires: python-devel >= 1:2.7
+BuildRequires: python-setuptools >= 1:44
+BuildRequires: python-six
+%endif
+%if %{with python3}
+BuildRequires: python3-devel >= 1:3.7
+BuildRequires: python3-setuptools >= 1:44
+BuildRequires: python3-six
+%endif
+BuildRequires: rpm-pythonprov
+BuildRequires: rpmbuild(macros) >= 1.714
+Requires:      python-modules >= 1:2.7
+BuildArch:     noarch
+BuildRoot:     %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+
+%description
+Python pam module supporting py3 (and py2) for Linux type systems.
+
+%description -l pl.UTF-8
+Moduł pam dla Pythona obsługujący py3 (oraz py2) na systemach
+linuksowych.
+
+%package -n python3-pam
+Summary:       Python PAM module using ctypes
+Summary(pl.UTF-8):     Moduł PAM dla Pythona wykorzystujący ctypes
+Group:         Libraries/Python
+Requires:      python3-modules >= 1:3.7
+
+%description -n python3-pam
+Python pam module supporting py3 (and py2) for Linux type systems.
+
+%description -n python3-pam -l pl.UTF-8
+Moduł pam dla Pythona obsługujący py3 (oraz py2) na systemach
+linuksowych.
+
+%prep
+%setup -q -n python-pam-%{version}
+%patch0 -p1
+
+cat >setup.py <<EOF
+from setuptools import setup
+setup()
+EOF
+
+%build
+%if %{with python2}
+%py_build
+%endif
+
+%if %{with python3}
+%py3_build
+%endif
+
+%install
+rm -rf $RPM_BUILD_ROOT
+
+%if %{with python2}
+%py_install
+
+%py_postclean
+%endif
+
+%if %{with python3}
+%py3_install
+%endif
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%if %{with python2}
+%files
+%defattr(644,root,root,755)
+%doc LICENSE README.md
+%{py_sitescriptdir}/pam
+%{py_sitescriptdir}/python_pam-%{version}-py*.egg-info
+%endif
+
+%if %{with python3}
+%files -n python3-pam
+%defattr(644,root,root,755)
+%doc LICENSE README.md
+%{py3_sitescriptdir}/pam
+%{py3_sitescriptdir}/python_pam-%{version}-py*.egg-info
+%endif
diff --git a/python-pam-py2.patch b/python-pam-py2.patch
new file mode 100644
index 0000000..c1d8055
--- /dev/null
+++ b/python-pam-py2.patch
@@ -0,0 +1,29 @@
+--- python-pam-2.0.2/src/pam/__internals.py.orig       2022-03-18 
01:23:10.000000000 +0100
++++ python-pam-2.0.2/src/pam/__internals.py    2024-07-21 19:05:20.343924566 
+0200
+@@ -99,7 +99,7 @@ class PamHandle(Structure):
+         self.handle = 0
+ 
+     def __repr__(self):
+-        return f"<PamHandle {self.handle}>"
++        return "<PamHandle %s>" % self.handle
+ 
+ 
+ class PamMessage(Structure):
+@@ -125,7 +125,7 @@ conv_func = CFUNCTYPE(c_int,
+                       c_void_p)
+ 
+ 
+-def my_conv(n_messages, messages, p_response, libc, msg_list: list, password: 
bytes, encoding: str):
++def my_conv(n_messages, messages, p_response, libc, msg_list, password, 
encoding):
+     """Simple conversation function that responds to any
+        prompt where the echo is off with the supplied password"""
+     # Create an array of n_messages response objects
+@@ -385,7 +385,7 @@ class PamAuthenticator:
+             self.handle = None
+ 
+         if print_failure_messages and self.code != PAM_SUCCESS:  # pragma: no 
cover
+-            print(f"Failure: {self.reason}")
++            print("Failure: %s" % self.reason)
+ 
+         return auth_success == PAM_SUCCESS
+ 
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/python-pam.git/commitdiff/4475121bb7af07a68607fbc747f36b6c5f5cabd6

_______________________________________________
pld-cvs-commit mailing list
pld-cvs-commit@lists.pld-linux.org
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to