diff mbox series

[05/23] libpwquality: backport a python 3.12 compatibility patch

Message ID 20231231122329.405225-5-alex@linutronix.de
State Accepted
Headers show
Series [01/23] fontforge: add a readline PACKAGECONFIG | expand

Commit Message

Alexander Kanavin Dec. 31, 2023, 12:23 p.m. UTC
This also allows dropping a previous patch.

Signed-off-by: Alexander Kanavin <alex@linutronix.de>
---
 ...-Use-setuptools-instead-of-distutils.patch | 78 +++++++++++++++++++
 ...missing-python-include-dir-for-cross.patch | 43 ----------
 .../libpwquality/libpwquality_1.4.5.bb        |  6 +-
 3 files changed, 81 insertions(+), 46 deletions(-)
 create mode 100644 meta-oe/recipes-extended/libpwquality/files/0001-Use-setuptools-instead-of-distutils.patch
 delete mode 100644 meta-oe/recipes-extended/libpwquality/files/add-missing-python-include-dir-for-cross.patch

Comments

Martin Jansa Jan. 10, 2024, 11:43 a.m. UTC | #1
It doesn't respect libdir now, causing installed-vs-shipped e.g. in
multilib builds with libdir set to /usr/lib32:

ERROR: QA Issue: lib32-libpwquality: Files/directories were installed but
not shipped in any package:
  /usr/lib/python3.11/site-packages/
pwquality.cpython-311-arm-linux-gnueabi.so
  /usr/lib/python3.11/site-packages/pwquality-1.4.5-py3.11.egg-info

/usr/lib/python3.11/site-packages/pwquality-1.4.5-py3.11.egg-info/SOURCES.txt
  /usr/lib/python3.11/site-packages/pwquality-1.4.5-py3.11.egg-info/PKG-INFO

/usr/lib/python3.11/site-packages/pwquality-1.4.5-py3.11.egg-info/dependency_links.txt

/usr/lib/python3.11/site-packages/pwquality-1.4.5-py3.11.egg-info/top_level.txt
Please set FILES such that these items are packaged. Alternatively if they
are unneeded, avoid installing them or delete them within do_install.
lib32-libpwquality: 6 installed and not shipped files.
[installed-vs-shipped]

On Sun, Dec 31, 2023 at 1:23 PM Alexander Kanavin <alex.kanavin@gmail.com>
wrote:

> This also allows dropping a previous patch.
>
> Signed-off-by: Alexander Kanavin <alex@linutronix.de>
> ---
>  ...-Use-setuptools-instead-of-distutils.patch | 78 +++++++++++++++++++
>  ...missing-python-include-dir-for-cross.patch | 43 ----------
>  .../libpwquality/libpwquality_1.4.5.bb        |  6 +-
>  3 files changed, 81 insertions(+), 46 deletions(-)
>  create mode 100644
> meta-oe/recipes-extended/libpwquality/files/0001-Use-setuptools-instead-of-distutils.patch
>  delete mode 100644
> meta-oe/recipes-extended/libpwquality/files/add-missing-python-include-dir-for-cross.patch
>
> diff --git
> a/meta-oe/recipes-extended/libpwquality/files/0001-Use-setuptools-instead-of-distutils.patch
> b/meta-oe/recipes-extended/libpwquality/files/0001-Use-setuptools-instead-of-distutils.patch
> new file mode 100644
> index 000000000..7eaca66b5
> --- /dev/null
> +++
> b/meta-oe/recipes-extended/libpwquality/files/0001-Use-setuptools-instead-of-distutils.patch
> @@ -0,0 +1,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')
> diff --git
> a/meta-oe/recipes-extended/libpwquality/files/add-missing-python-include-dir-for-cross.patch
> b/meta-oe/recipes-extended/libpwquality/files/add-missing-python-include-dir-for-cross.patch
> deleted file mode 100644
> index 636b29407..000000000
> ---
> a/meta-oe/recipes-extended/libpwquality/files/add-missing-python-include-dir-for-cross.patch
> +++ /dev/null
> @@ -1,43 +0,0 @@
> -From 1ea09e09ab2387c326bb7170835361ece6e25477 Mon Sep 17 00:00:00 2001
> -From: Hongxu Jia <hongxu.jia@windriver.com>
> -Date: Mon, 3 Aug 2015 13:43:14 +0800
> -Subject: [PATCH] setup.py.in: add missing python include dir for cross
> - compiling
> -
> -Upstream-Status: Inappropriate [oe-core specific]
> -
> -Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
> ----
> - python/Makefile.am | 2 +-
> - python/setup.py.in | 3 ++-
> - 2 files changed, 3 insertions(+), 2 deletions(-)
> -
> -diff --git a/python/Makefile.am b/python/Makefile.am
> -index 1d00c0c..52816b2 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 --prefix=${DESTDIR}${prefix}
> --install-lib=${DESTDIR}/${PYTHONSITEDIR}
> -
> - clean-local:
> -       rm -rf py$(PYTHONREV)
> -diff --git a/python/setup.py.in b/python/setup.py.in
> -index a741b91..6759a95 100755
> ---- a/python/setup.py.in
> -+++ b/python/setup.py.in
> -@@ -33,7 +33,7 @@ class sdist(_sdist):
> -
> - pwqmodule = Extension('pwquality',
> -             sources = ['pwquality.c'],
> --            include_dirs = ['../src'],
> -+            include_dirs = ['../src',
> os.path.join(os.environ['STAGING_INCDIR'], os.environ['PYTHON_DIR'])],
> -             library_dirs = ['../src/.libs'],
> -             libraries = ['pwquality'])
> -
> ---
> -2.17.1
> -
> diff --git a/meta-oe/recipes-extended/libpwquality/libpwquality_1.4.5.bb
> b/meta-oe/recipes-extended/libpwquality/libpwquality_1.4.5.bb
> index 5287430c4..91afedcb6 100644
> --- a/meta-oe/recipes-extended/libpwquality/libpwquality_1.4.5.bb
> +++ b/meta-oe/recipes-extended/libpwquality/libpwquality_1.4.5.bb
> @@ -5,11 +5,11 @@ SECTION = "devel/lib"
>  LICENSE = "GPL-2.0-or-later"
>  LIC_FILES_CHKSUM = "file://COPYING;md5=6bd2f1386df813a459a0c34fde676fc2"
>
> -DEPENDS = "cracklib"
> +DEPENDS = "cracklib python3-setuptools-native"
>
>  SRC_URI = "git://
> github.com/libpwquality/libpwquality;branch=master;protocol=https \
> -           file://add-missing-python-include-dir-for-cross.patch \
> -"
> +           file://0001-Use-setuptools-instead-of-distutils.patch \
> +           "
>  SRCREV = "5490e96a3dd6ed7371435ca5b3ccef98bdb48b5a"
>
>  S = "${WORKDIR}/git"
> --
> 2.39.2
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#107956):
> https://lists.openembedded.org/g/openembedded-devel/message/107956
> Mute This Topic: https://lists.openembedded.org/mt/103445561/3617156
> Group Owner: openembedded-devel+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [
> martin.jansa@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
>
Alexander Kanavin Jan. 10, 2024, 11:58 a.m. UTC | #2
I guess this change needs to be rebased and restored on top of the
backported patch:

--      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
--prefix=${DESTDIR}${prefix} --install-lib=${DESTDIR}/${PYTHONSITEDIR}

Can you try that please?

Alex

On Wed, 10 Jan 2024 at 12:43, Martin Jansa <martin.jansa@gmail.com> wrote:
>
> It doesn't respect libdir now, causing installed-vs-shipped e.g. in multilib builds with libdir set to /usr/lib32:
>
> ERROR: QA Issue: lib32-libpwquality: Files/directories were installed but not shipped in any package:
>   /usr/lib/python3.11/site-packages/pwquality.cpython-311-arm-linux-gnueabi.so
>   /usr/lib/python3.11/site-packages/pwquality-1.4.5-py3.11.egg-info
>   /usr/lib/python3.11/site-packages/pwquality-1.4.5-py3.11.egg-info/SOURCES.txt
>   /usr/lib/python3.11/site-packages/pwquality-1.4.5-py3.11.egg-info/PKG-INFO
>   /usr/lib/python3.11/site-packages/pwquality-1.4.5-py3.11.egg-info/dependency_links.txt
>   /usr/lib/python3.11/site-packages/pwquality-1.4.5-py3.11.egg-info/top_level.txt
> Please set FILES such that these items are packaged. Alternatively if they are unneeded, avoid installing them or delete them within do_install.
> lib32-libpwquality: 6 installed and not shipped files. [installed-vs-shipped]
>
> On Sun, Dec 31, 2023 at 1:23 PM Alexander Kanavin <alex.kanavin@gmail.com> wrote:
>>
>> This also allows dropping a previous patch.
>>
>> Signed-off-by: Alexander Kanavin <alex@linutronix.de>
>> ---
>>  ...-Use-setuptools-instead-of-distutils.patch | 78 +++++++++++++++++++
>>  ...missing-python-include-dir-for-cross.patch | 43 ----------
>>  .../libpwquality/libpwquality_1.4.5.bb        |  6 +-
>>  3 files changed, 81 insertions(+), 46 deletions(-)
>>  create mode 100644 meta-oe/recipes-extended/libpwquality/files/0001-Use-setuptools-instead-of-distutils.patch
>>  delete mode 100644 meta-oe/recipes-extended/libpwquality/files/add-missing-python-include-dir-for-cross.patch
>>
>> diff --git a/meta-oe/recipes-extended/libpwquality/files/0001-Use-setuptools-instead-of-distutils.patch b/meta-oe/recipes-extended/libpwquality/files/0001-Use-setuptools-instead-of-distutils.patch
>> new file mode 100644
>> index 000000000..7eaca66b5
>> --- /dev/null
>> +++ b/meta-oe/recipes-extended/libpwquality/files/0001-Use-setuptools-instead-of-distutils.patch
>> @@ -0,0 +1,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')
>> diff --git a/meta-oe/recipes-extended/libpwquality/files/add-missing-python-include-dir-for-cross.patch b/meta-oe/recipes-extended/libpwquality/files/add-missing-python-include-dir-for-cross.patch
>> deleted file mode 100644
>> index 636b29407..000000000
>> --- a/meta-oe/recipes-extended/libpwquality/files/add-missing-python-include-dir-for-cross.patch
>> +++ /dev/null
>> @@ -1,43 +0,0 @@
>> -From 1ea09e09ab2387c326bb7170835361ece6e25477 Mon Sep 17 00:00:00 2001
>> -From: Hongxu Jia <hongxu.jia@windriver.com>
>> -Date: Mon, 3 Aug 2015 13:43:14 +0800
>> -Subject: [PATCH] setup.py.in: add missing python include dir for cross
>> - compiling
>> -
>> -Upstream-Status: Inappropriate [oe-core specific]
>> -
>> -Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
>> ----
>> - python/Makefile.am | 2 +-
>> - python/setup.py.in | 3 ++-
>> - 2 files changed, 3 insertions(+), 2 deletions(-)
>> -
>> -diff --git a/python/Makefile.am b/python/Makefile.am
>> -index 1d00c0c..52816b2 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 --prefix=${DESTDIR}${prefix} --install-lib=${DESTDIR}/${PYTHONSITEDIR}
>> -
>> - clean-local:
>> -       rm -rf py$(PYTHONREV)
>> -diff --git a/python/setup.py.in b/python/setup.py.in
>> -index a741b91..6759a95 100755
>> ---- a/python/setup.py.in
>> -+++ b/python/setup.py.in
>> -@@ -33,7 +33,7 @@ class sdist(_sdist):
>> -
>> - pwqmodule = Extension('pwquality',
>> -             sources = ['pwquality.c'],
>> --            include_dirs = ['../src'],
>> -+            include_dirs = ['../src', os.path.join(os.environ['STAGING_INCDIR'], os.environ['PYTHON_DIR'])],
>> -             library_dirs = ['../src/.libs'],
>> -             libraries = ['pwquality'])
>> -
>> ---
>> -2.17.1
>> -
>> diff --git a/meta-oe/recipes-extended/libpwquality/libpwquality_1.4.5.bb b/meta-oe/recipes-extended/libpwquality/libpwquality_1.4.5.bb
>> index 5287430c4..91afedcb6 100644
>> --- a/meta-oe/recipes-extended/libpwquality/libpwquality_1.4.5.bb
>> +++ b/meta-oe/recipes-extended/libpwquality/libpwquality_1.4.5.bb
>> @@ -5,11 +5,11 @@ SECTION = "devel/lib"
>>  LICENSE = "GPL-2.0-or-later"
>>  LIC_FILES_CHKSUM = "file://COPYING;md5=6bd2f1386df813a459a0c34fde676fc2"
>>
>> -DEPENDS = "cracklib"
>> +DEPENDS = "cracklib python3-setuptools-native"
>>
>>  SRC_URI = "git://github.com/libpwquality/libpwquality;branch=master;protocol=https \
>> -           file://add-missing-python-include-dir-for-cross.patch \
>> -"
>> +           file://0001-Use-setuptools-instead-of-distutils.patch \
>> +           "
>>  SRCREV = "5490e96a3dd6ed7371435ca5b3ccef98bdb48b5a"
>>
>>  S = "${WORKDIR}/git"
>> --
>> 2.39.2
>>
>>
>> -=-=-=-=-=-=-=-=-=-=-=-
>> Links: You receive all messages sent to this group.
>> View/Reply Online (#107956): https://lists.openembedded.org/g/openembedded-devel/message/107956
>> Mute This Topic: https://lists.openembedded.org/mt/103445561/3617156
>> Group Owner: openembedded-devel+owner@lists.openembedded.org
>> Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [martin.jansa@gmail.com]
>> -=-=-=-=-=-=-=-=-=-=-=-
>>
diff mbox series

Patch

diff --git a/meta-oe/recipes-extended/libpwquality/files/0001-Use-setuptools-instead-of-distutils.patch b/meta-oe/recipes-extended/libpwquality/files/0001-Use-setuptools-instead-of-distutils.patch
new file mode 100644
index 000000000..7eaca66b5
--- /dev/null
+++ b/meta-oe/recipes-extended/libpwquality/files/0001-Use-setuptools-instead-of-distutils.patch
@@ -0,0 +1,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')
diff --git a/meta-oe/recipes-extended/libpwquality/files/add-missing-python-include-dir-for-cross.patch b/meta-oe/recipes-extended/libpwquality/files/add-missing-python-include-dir-for-cross.patch
deleted file mode 100644
index 636b29407..000000000
--- a/meta-oe/recipes-extended/libpwquality/files/add-missing-python-include-dir-for-cross.patch
+++ /dev/null
@@ -1,43 +0,0 @@ 
-From 1ea09e09ab2387c326bb7170835361ece6e25477 Mon Sep 17 00:00:00 2001
-From: Hongxu Jia <hongxu.jia@windriver.com>
-Date: Mon, 3 Aug 2015 13:43:14 +0800
-Subject: [PATCH] setup.py.in: add missing python include dir for cross
- compiling
-
-Upstream-Status: Inappropriate [oe-core specific]
-
-Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
----
- python/Makefile.am | 2 +-
- python/setup.py.in | 3 ++-
- 2 files changed, 3 insertions(+), 2 deletions(-)
-
-diff --git a/python/Makefile.am b/python/Makefile.am
-index 1d00c0c..52816b2 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 --prefix=${DESTDIR}${prefix} --install-lib=${DESTDIR}/${PYTHONSITEDIR}
- 
- clean-local:
- 	rm -rf py$(PYTHONREV)
-diff --git a/python/setup.py.in b/python/setup.py.in
-index a741b91..6759a95 100755
---- a/python/setup.py.in
-+++ b/python/setup.py.in
-@@ -33,7 +33,7 @@ class sdist(_sdist):
- 
- pwqmodule = Extension('pwquality',
-             sources = ['pwquality.c'],
--            include_dirs = ['../src'],
-+            include_dirs = ['../src', os.path.join(os.environ['STAGING_INCDIR'], os.environ['PYTHON_DIR'])],
-             library_dirs = ['../src/.libs'],
-             libraries = ['pwquality'])
- 
--- 
-2.17.1
-
diff --git a/meta-oe/recipes-extended/libpwquality/libpwquality_1.4.5.bb b/meta-oe/recipes-extended/libpwquality/libpwquality_1.4.5.bb
index 5287430c4..91afedcb6 100644
--- a/meta-oe/recipes-extended/libpwquality/libpwquality_1.4.5.bb
+++ b/meta-oe/recipes-extended/libpwquality/libpwquality_1.4.5.bb
@@ -5,11 +5,11 @@  SECTION = "devel/lib"
 LICENSE = "GPL-2.0-or-later"
 LIC_FILES_CHKSUM = "file://COPYING;md5=6bd2f1386df813a459a0c34fde676fc2"
 
-DEPENDS = "cracklib"
+DEPENDS = "cracklib python3-setuptools-native"
 
 SRC_URI = "git://github.com/libpwquality/libpwquality;branch=master;protocol=https \
-           file://add-missing-python-include-dir-for-cross.patch \
-"
+           file://0001-Use-setuptools-instead-of-distutils.patch \
+           "
 SRCREV = "5490e96a3dd6ed7371435ca5b3ccef98bdb48b5a"
 
 S = "${WORKDIR}/git"