[packages/python3-pyquota] Initial.

arekm arekm at pld-linux.org
Fri Sep 11 15:50:14 CEST 2026


commit cbb4744ab63e168c86d58c3dffc443c7f558102d
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Fri Sep 11 15:48:43 2026 +0200

    Initial.

 pyquota-strerror.patch | 22 +++++++++++++++
 python3-pyquota.spec   | 75 ++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 97 insertions(+)
---
diff --git a/python3-pyquota.spec b/python3-pyquota.spec
new file mode 100644
index 0000000..29241c6
--- /dev/null
+++ b/python3-pyquota.spec
@@ -0,0 +1,75 @@
+#
+# Conditional build:
+%bcond_without	tests	# unit tests
+
+%define		module	pyquota
+Summary:	Python 3 wrapper for Linux quotactl(2) API
+Summary(pl.UTF-8):	Interfejs Pythona 3 do linuksowego API quotactl(2)
+Name:		python3-%{module}
+Version:	0.1.3
+Release:	1
+License:	MIT
+Group:		Libraries/Python
+#Source0Download: https://pypi.org/simple/pyquota/
+Source0:	https://files.pythonhosted.org/packages/source/p/pyquota/%{module}-%{version}.tar.gz
+# Source0-md5:	be1691f7d6ded39551e6fe6d8623239a
+Patch0:		%{module}-strerror.patch
+URL:		https://github.com/tjumyk/pyquota
+BuildRequires:	python3-devel >= 1:3.9
+BuildRequires:	python3-setuptools >= 1:61
+%if %{with tests}
+BuildRequires:	python3-pytest
+%endif
+BuildRequires:	rpm-pythonprov
+BuildRequires:	rpmbuild(macros) >= 1.714
+Requires:	python3-modules >= 1:3.9
+BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+
+%description
+PyQuota is a Python wrapper for the Linux quotactl(2) API. It covers
+user, group and project quotas on local filesystems: turning quotas on
+and off, reading and setting limits and usage, iterating over all IDs
+with quota, and reading and setting quota info such as grace periods.
+
+%description -l pl.UTF-8
+PyQuota to interfejs Pythona do linuksowego API quotactl(2). Obsługuje
+limity (quota) użytkowników, grup i projektów na lokalnych systemach
+plików: włączanie i wyłączanie limitów, odczyt i ustawianie limitów
+oraz zużycia, iterowanie po wszystkich identyfikatorach z limitami, a
+także odczyt i ustawianie informacji o limitach, takich jak okresy
+karencji.
+
+%prep
+%setup -q -n %{module}-%{version}
+%patch -P0 -p1
+
+%build
+%py3_build
+
+%if %{with tests}
+# run from build dir so the .so-less source pyquota/ does not shadow the built package
+cd build-3/lib.*
+PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 \
+PYTHONPATH=$(pwd) \
+%{__python3} -m pytest ../../tests
+cd ../..
+%endif
+
+%install
+rm -rf $RPM_BUILD_ROOT
+
+%py3_install
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%files
+%defattr(644,root,root,755)
+%doc LICENSE README.md
+%dir %{py3_sitedir}/pyquota
+%{py3_sitedir}/pyquota/*.py
+%{py3_sitedir}/pyquota/__pycache__
+%{py3_sitedir}/pyquota/__init__.pyi
+%{py3_sitedir}/pyquota/py.typed
+%{py3_sitedir}/pyquota/_native.cpython-*.so
+%{py3_sitedir}/PyQuota-%{version}-py*.egg-info
diff --git a/pyquota-strerror.patch b/pyquota-strerror.patch
new file mode 100644
index 0000000..cbe784f
--- /dev/null
+++ b/pyquota-strerror.patch
@@ -0,0 +1,22 @@
+# with _GNU_SOURCE strerror_r() returns the message and may leave buf uninitialized
+diff -ur pyquota-0.1.3.orig/pyquota.c pyquota-0.1.3/pyquota.c
+--- pyquota-0.1.3.orig/pyquota.c	2026-09-11 15:48:22.848568416 +0200
++++ pyquota-0.1.3/pyquota.c	2026-09-11 15:48:22.939749237 +0200
+@@ -134,12 +134,12 @@
+             msg = "Specified limits are out of the range allowed by the quota format";
+             exc_type = InvalidError;
+             break;
+-        default: {
+-            char buf[ERRMSG_BUF_SIZE];
+-            strerror_r(saved_errno, buf, sizeof(buf));
+-            setApiErrorEx(APIError, buf, saved_errno);
++        default:
++            /* GIL is held, so strerror() is safe; with _GNU_SOURCE (set by
++             * Python.h) strerror_r() may return a static string and leave
++             * the caller's buffer untouched */
++            setApiErrorEx(APIError, strerror(saved_errno), saved_errno);
+             return;
+-        }
+     }
+     setApiErrorEx(exc_type, msg, saved_errno);
+ }
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/python3-pyquota.git/commitdiff/cbb4744ab63e168c86d58c3dffc443c7f558102d



More information about the pld-cvs-commit mailing list