From 0bf97bb95132e939f9ab1a0fdff4119bd442b0bc Mon Sep 17 00:00:00 2001 From: rawrmonster17 Date: Thu, 18 Jun 2026 23:24:23 -0500 Subject: [PATCH] python: replace deprecated 'setup.py install' with PEP 517 wheel install Running 'setup.py install' directly is deprecated by setuptools and triggers a SetuptoolsDeprecationWarning on every 'make install'. The warning text recommends using standards-based build tools instead. Replace the install path in src/python/Makefile.am: Before: PY_INSTALL = ${PY_DISTUTILS} install install-exec-local runs ${PY_INSTALL} --install-lib=... --record=... After: Build the wheel with 'python -m build --wheel --no-isolation' (PEP 517, does not invoke the deprecated install command), then install it with 'python -m installer --destdir=... --prefix=...' (PEP 427 / pypa/installer). The 'make check' / 'make check-build' paths are unaffected: they use the PY_BUILD target (setup.py build) which is not deprecated. The uninstall-local target switches from a manual install_files.txt record to 'pip uninstall --yes seccomp', which uses the dist-info/RECORD written by installer and is the recommended uninstall mechanism for wheel-installed packages. Update .github/actions/setup/action.yml to install the additional build-time Python dependencies (wheel, build, installer) that the new install path requires alongside the existing cython dependency. Fixes: Github Issue #444 Signed-off-by: rawrmonster17 --- .github/actions/setup/action.yml | 2 +- src/python/Makefile.am | 20 +++++++++++++++----- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml index d51400d5..2ab09643 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup/action.yml @@ -31,7 +31,7 @@ runs: - run: | sudo apt-get install -y python3 python3-setuptools python3-pip python3 -m pip install --upgrade pip - python3 -m pip install cython + python3 -m pip install cython wheel build installer # Add cython to the path echo "$HOME/.local/bin" >> $GITHUB_PATH shell: bash diff --git a/src/python/Makefile.am b/src/python/Makefile.am index cc98a911..533261e9 100644 --- a/src/python/Makefile.am +++ b/src/python/Makefile.am @@ -29,7 +29,15 @@ PY_BUILD_1 = ${PY_DISTUTILS} build PY_BUILD_ = ${PY_BUILD_0} PY_BUILD = ${PY_BUILD_@AM_V@} -PY_INSTALL = ${PY_DISTUTILS} install +# Build a wheel via PEP 517 (python -m build --no-isolation) to avoid the +# deprecated "setup.py install" invocation. The --no-isolation flag reuses +# the in-tree build environment rather than creating an isolated venv. +PY_BDIST_WHEEL = \ + VERSION_RELEASE="@PACKAGE_VERSION@" \ + CPPFLAGS="-I\${top_srcdir}/include ${AM_CPPFLAGS} ${CPPFLAGS}" \ + CFLAGS="${AM_CFLAGS} ${CFLAGS}" \ + LDFLAGS="${AM_LDFLAGS} ${LDFLAGS}" \ + ${PYTHON} -m build --wheel --no-isolation EXTRA_DIST = libseccomp.pxd seccomp.pyx setup.py @@ -40,12 +48,14 @@ build: ../libseccomp.la libseccomp.pxd seccomp.pyx setup.py ${PY_BUILD} && touch build install-exec-local: build - ${PY_INSTALL} --install-lib=${DESTDIR}/${pyexecdir} \ - --record=${DESTDIR}/${pyexecdir}/install_files.txt + ${PY_BDIST_WHEEL} + ${PYTHON} -m installer \ + --destdir=${DESTDIR}/ \ + --prefix=${prefix} \ + dist/seccomp-*.whl uninstall-local: - cat ${DESTDIR}/${pyexecdir}/install_files.txt | xargs ${RM} -f - ${RM} -f ${DESTDIR}/${pyexecdir}/install_files.txt + ${PYTHON} -m pip uninstall --yes seccomp clean-local: [ ${srcdir} = ${builddir} ] || ${RM} -f ${builddir}/seccomp.pyx