Use setuptools instead of distutils to fix FTBFS with Python 3.12+

This commit is contained in:
Miro Hrončok 2023-03-31 14:54:59 +02:00
parent f84a5e3ba6
commit b0a989aaf2
2 changed files with 57 additions and 2 deletions

View File

@ -1,9 +1,16 @@
Summary: A library for password generation and password quality checking
Name: libpwquality
Version: 1.4.5
Release: 3%{?dist}
Release: 4%{?dist}
URL: https://github.com/libpwquality/libpwquality/
Source0: https://github.com/libpwquality/libpwquality/releases/download/libpwquality-%{version}/libpwquality-%{version}.tar.bz2
# Use setuptools instead of distutils
# This fixes the build with Python 3.12+
# https://bugzilla.redhat.com/2165572
# Upstream PR: https://github.com/libpwquality/libpwquality/pull/74
Patch1: setuptools.patch
# The package is BSD licensed with option to relicense as GPLv2+
# - this option is redundant as the BSD license allows that anyway.
License: BSD or GPLv2+
@ -21,6 +28,7 @@ BuildRequires: cracklib-devel
BuildRequires: gettext
BuildRequires: pam-devel
BuildRequires: python3-devel
BuildRequires: python3-setuptools
%description
This is a library for password quality checks and generation
@ -49,7 +57,7 @@ for easy password quality checking and generation of random
pronounceable passwords from Python applications.
%prep
%setup -q
%autosetup -p1
%build
%configure \
@ -100,6 +108,10 @@ mkdir %{buildroot}%{_secconfdir}/pwquality.conf.d
%{python3_sitearch}/*.egg-info
%changelog
* Fri Mar 31 2023 Miro Hrončok <mhroncok@redhat.com> - 1.4.5-4
- Use setuptools instead of distutils to build this package
- Resolves: rhbz#2165572
* Wed Feb 01 2023 Adam Williamson <awilliam@redhat.com> - 1.4.5-3
- Strengthen cracklib-dicts dependency to Recommends (#2158891)

43
setuptools.patch Normal file
View File

@ -0,0 +1,43 @@
diff --git a/python/Makefile.am b/python/Makefile.am
index 1d00c0c..6e51744 100644
--- a/python/Makefile.am
+++ b/python/Makefile.am
@@ -14,7 +14,7 @@ all-local:
CFLAGS="${CFLAGS} -fno-strict-aliasing" @PYTHONBINARY@ setup.py build --build-base py$(PYTHONREV)
install-exec-local:
- CFLAGS="${CFLAGS} -fno-strict-aliasing" @PYTHONBINARY@ setup.py build --build-base py$(PYTHONREV) install --prefix=${DESTDIR}${prefix}
+ CFLAGS="${CFLAGS} -fno-strict-aliasing" @PYTHONBINARY@ setup.py build --build-base py$(PYTHONREV) install --root ${DESTDIR} --prefix=${prefix}
clean-local:
rm -rf py$(PYTHONREV)
diff --git a/python/Makefile.in b/python/Makefile.in
index f47ac5e..8e9c7f2 100644
--- a/python/Makefile.in
+++ b/python/Makefile.in
@@ -483,7 +483,7 @@ all-local:
CFLAGS="${CFLAGS} -fno-strict-aliasing" @PYTHONBINARY@ setup.py build --build-base py$(PYTHONREV)
install-exec-local:
- CFLAGS="${CFLAGS} -fno-strict-aliasing" @PYTHONBINARY@ setup.py build --build-base py$(PYTHONREV) install --prefix=${DESTDIR}${prefix}
+ CFLAGS="${CFLAGS} -fno-strict-aliasing" @PYTHONBINARY@ setup.py build --build-base py$(PYTHONREV) install --root=${DESTDIR} --prefix=${prefix}
clean-local:
rm -rf py$(PYTHONREV)
diff --git a/python/setup.py.in b/python/setup.py.in
index a741b91..f934c50 100755
--- a/python/setup.py.in
+++ b/python/setup.py.in
@@ -6,9 +6,9 @@
import os
-from distutils.core import setup, Extension
-from distutils.command.build_ext import build_ext as _build_ext
-from distutils.command.sdist import sdist as _sdist
+from setuptools import setup, Extension
+from setuptools.command.build_ext import build_ext as _build_ext
+from setuptools.command.sdist import sdist as _sdist
def genconstants(headerfile, outputfile):
hf = open(headerfile, 'r')