libpwquality: make python bindings optional via PACKAGECONFIG

The python bindings are built unconditionally, so using libpwquality
drags libpython3 and python3-core onto the image even when only the C
library or pam_pwquality is needed.

Add a "python3" PACKAGECONFIG for the bindings, enabled by default to
keep the current behaviour. The setuptools3-base inherit is deferred
and conditional on it. With python3 disabled, the package depends only
on cracklib and libc.

Signed-off-by: Markus Klotzbuecher <mk@mkio.de>
Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
This commit is contained in:
Markus Klotzbuecher
2026-06-06 13:12:17 +02:00
committed by Khem Raj
parent 44ec3710d5
commit 43f2dc81c5
@@ -5,7 +5,7 @@ SECTION = "devel/lib"
LICENSE = "GPL-2.0-or-later"
LIC_FILES_CHKSUM = "file://COPYING;md5=6bd2f1386df813a459a0c34fde676fc2"
DEPENDS = "cracklib python3-setuptools-native"
DEPENDS = "cracklib"
SRC_URI = "git://github.com/libpwquality/libpwquality;branch=master;protocol=https \
file://0001-Use-setuptools-instead-of-distutils.patch \
@@ -14,7 +14,8 @@ SRC_URI = "git://github.com/libpwquality/libpwquality;branch=master;protocol=htt
SRCREV = "5490e96a3dd6ed7371435ca5b3ccef98bdb48b5a"
inherit autotools-brokensep gettext setuptools3-base
inherit autotools-brokensep gettext
inherit_defer ${@bb.utils.contains('PACKAGECONFIG', 'python3', 'setuptools3-base', '', d)}
do_configure:prepend() {
cp ${STAGING_DATADIR_NATIVE}/gettext/ABOUT-NLS ${AUTOTOOLS_AUXDIR}/
@@ -24,15 +25,13 @@ export PYTHON_DIR
export BUILD_SYS
export HOST_SYS
EXTRA_OECONF += "--with-python-rev=${PYTHON_BASEVERSION} \
--with-python-binary=${STAGING_BINDIR_NATIVE}/python3-native/python3 \
--with-pythonsitedir=${PYTHON_SITEPACKAGES_DIR} \
--libdir=${libdir} \
EXTRA_OECONF += "--libdir=${libdir} \
--with-securedir=${base_libdir}/security \
"
PACKAGECONFIG ??= "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'pam', '', d)}"
PACKAGECONFIG ??= "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'pam', '', d)} python3"
PACKAGECONFIG[pam] = "--enable-pam,--disable-pam,libpam"
PACKAGECONFIG[python3] = "--enable-python-bindings --with-python-rev=${PYTHON_BASEVERSION} --with-python-binary=${STAGING_BINDIR_NATIVE}/python3-native/python3 --with-pythonsitedir=${PYTHON_SITEPACKAGES_DIR},--disable-python-bindings,python3-setuptools-native"
FILES:${PN} += "${base_libdir}/security/pam_pwquality.so"
FILES:${PN}-dbg += "${base_libdir}/security/.debug"