0001-Use-setuptools-instead-of-distutils.patch 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. From 7b5e0f0097faebdcc6a8b783237bbba7a983147a Mon Sep 17 00:00:00 2001
  2. From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz>
  3. Date: Fri, 31 Mar 2023 14:52:19 +0200
  4. Subject: [PATCH] Use setuptools instead of distutils
  5. distutils is removed from Python 3.12+:
  6. https://peps.python.org/pep-0632/
  7. Upstream: https://github.com/libpwquality/libpwquality/commit/7b5e0f0097faebdcc6a8b783237bbba7a983147a
  8. Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
  9. ---
  10. libpwquality.spec.in | 11 ++---------
  11. python/Makefile.am | 2 +-
  12. python/setup.py.in | 6 +++---
  13. 3 files changed, 6 insertions(+), 13 deletions(-)
  14. diff --git a/libpwquality.spec.in b/libpwquality.spec.in
  15. index 70a6f53..0809126 100644
  16. --- a/libpwquality.spec.in
  17. +++ b/libpwquality.spec.in
  18. @@ -33,9 +33,11 @@ BuildRequires: gettext
  19. BuildRequires: pam-devel
  20. %if %{with python2}
  21. BuildRequires: python2-devel
  22. +BuildRequires: python2-setuptools
  23. %endif
  24. %if %{with python3}
  25. BuildRequires: python3-devel
  26. +BuildRequires: python3-setuptools
  27. %endif
  28. URL: https://github.com/libpwquality/libpwquality/
  29. @@ -103,15 +105,6 @@ cp -a . %{py3dir}
  30. pushd %{py3dir}
  31. %endif
  32. %if %{with python3}
  33. -# setuptools >= 60 changes the environment to use its bundled copy of distutils
  34. -# by default, not the Python-bundled one. To run the Python's standard library
  35. -# distutils, the environment variable must be set.
  36. -# Although technically setuptools is not needed for this package, if it's
  37. -# pulled by another package, it changes the environment and consequently,
  38. -# the build fails. This was reported in:
  39. -# https://github.com/pypa/setuptools/issues/3143
  40. -export SETUPTOOLS_USE_DISTUTILS=stdlib
  41. -
  42. %configure \
  43. --with-securedir=%{_moduledir} \
  44. --with-pythonsitedir=%{python3_sitearch} \
  45. diff --git a/python/Makefile.am b/python/Makefile.am
  46. index 1d00c0c..6e51744 100644
  47. --- a/python/Makefile.am
  48. +++ b/python/Makefile.am
  49. @@ -14,7 +14,7 @@ all-local:
  50. CFLAGS="${CFLAGS} -fno-strict-aliasing" @PYTHONBINARY@ setup.py build --build-base py$(PYTHONREV)
  51. install-exec-local:
  52. - CFLAGS="${CFLAGS} -fno-strict-aliasing" @PYTHONBINARY@ setup.py build --build-base py$(PYTHONREV) install --prefix=${DESTDIR}${prefix}
  53. + CFLAGS="${CFLAGS} -fno-strict-aliasing" @PYTHONBINARY@ setup.py build --build-base py$(PYTHONREV) install --root ${DESTDIR} --prefix=${prefix}
  54. clean-local:
  55. rm -rf py$(PYTHONREV)
  56. diff --git a/python/setup.py.in b/python/setup.py.in
  57. index a741b91..f934c50 100755
  58. --- a/python/setup.py.in
  59. +++ b/python/setup.py.in
  60. @@ -6,9 +6,9 @@
  61. import os
  62. -from distutils.core import setup, Extension
  63. -from distutils.command.build_ext import build_ext as _build_ext
  64. -from distutils.command.sdist import sdist as _sdist
  65. +from setuptools import setup, Extension
  66. +from setuptools.command.build_ext import build_ext as _build_ext
  67. +from setuptools.command.sdist import sdist as _sdist
  68. def genconstants(headerfile, outputfile):
  69. hf = open(headerfile, 'r')