From b0a989aaf2e83df337250a80fc511dea30244798 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Fri, 31 Mar 2023 14:54:59 +0200 Subject: [PATCH] Use setuptools instead of distutils to fix FTBFS with Python 3.12+ --- libpwquality.spec | 16 ++++++++++++++-- setuptools.patch | 43 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 2 deletions(-) create mode 100644 setuptools.patch diff --git a/libpwquality.spec b/libpwquality.spec index 8293d2e..ab7d34d 100644 --- a/libpwquality.spec +++ b/libpwquality.spec @@ -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 - 1.4.5-4 +- Use setuptools instead of distutils to build this package +- Resolves: rhbz#2165572 + * Wed Feb 01 2023 Adam Williamson - 1.4.5-3 - Strengthen cracklib-dicts dependency to Recommends (#2158891) diff --git a/setuptools.patch b/setuptools.patch new file mode 100644 index 0000000..818a4c0 --- /dev/null +++ b/setuptools.patch @@ -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')