aboutsummaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-extended/libpwquality/files/0001-Use-setuptools-instead-of-distutils.patch
blob: 7eaca66b5ce43b0f7b8d71e847090b99670f4b69 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
From ad95b7684365dea8335c34527d4c1463c1668af0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz>
Date: Fri, 31 Mar 2023 14:52:19 +0200
Subject: [PATCH] Use setuptools instead of distutils

distutils is removed from Python 3.12+:
https://peps.python.org/pep-0632/

Upstream-Status: Backport [https://github.com/libpwquality/libpwquality/commit/7b5e0f0097faebdcc6a8b783237bbba7a983147a]
Signed-off-by: Alexander Kanavin <alex@linutronix.de>
---
 libpwquality.spec.in | 11 ++---------
 python/Makefile.am   |  2 +-
 python/setup.py.in   |  6 +++---
 3 files changed, 6 insertions(+), 13 deletions(-)

diff --git a/libpwquality.spec.in b/libpwquality.spec.in
index 70a6f53..0809126 100644
--- a/libpwquality.spec.in
+++ b/libpwquality.spec.in
@@ -33,9 +33,11 @@ BuildRequires: gettext
 BuildRequires: pam-devel
 %if %{with python2}
 BuildRequires: python2-devel
+BuildRequires: python2-setuptools
 %endif
 %if %{with python3}
 BuildRequires: python3-devel
+BuildRequires: python3-setuptools
 %endif
 
 URL: https://github.com/libpwquality/libpwquality/
@@ -103,15 +105,6 @@ cp -a . %{py3dir}
 pushd %{py3dir}
 %endif
 %if %{with python3}
-# setuptools >= 60 changes the environment to use its bundled copy of distutils
-# by default, not the Python-bundled one. To run the Python's standard library
-# distutils, the environment variable must be set.
-# Although technically setuptools is not needed for this package, if it's
-# pulled by another package, it changes the environment and consequently,
-# the build fails. This was reported in:
-# https://github.com/pypa/setuptools/issues/3143
-export SETUPTOOLS_USE_DISTUTILS=stdlib
-
 %configure \
 	--with-securedir=%{_moduledir} \
 	--with-pythonsitedir=%{python3_sitearch} \
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/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')