python: replace deprecated 'setup.py install' with PEP 517 wheel install#493
Open
rawrmonster17 wants to merge 1 commit into
Open
python: replace deprecated 'setup.py install' with PEP 517 wheel install#493rawrmonster17 wants to merge 1 commit into
rawrmonster17 wants to merge 1 commit into
Conversation
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 seccomp#444
Signed-off-by: rawrmonster17 <rawrmonster17@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Running
make installwith--enable-pythonprints a deprecation warning onevery invocation:
The root cause is
src/python/Makefile.aminvokingsetup.py installininstall-exec-localviaPY_INSTALL = ${PY_DISTUTILS} install. This wasnot fixed by the earlier distutils→setuptools migration (PR #374) which
addressed the import deprecation but not the command deprecation.
Fixes: Github Issue #444
Fix
Replace the
install-exec-localtarget with a two-step PEP 517 workflow:Build a wheel using
python -m build --wheel --no-isolation.The
--no-isolationflag reuses the in-tree build environment (samecompiler flags, same libseccomp.a) rather than creating an isolated venv.
This does not invoke the deprecated
setup.py installcommand path.Install the wheel using
python -m installer --destdir --prefix.pypa/installeris a minimal, standards-based wheel installer that writesthe dist-info/RECORD used by
pip uninstallfor clean removal.The
uninstall-localtarget is updated to usepip uninstall --yes seccomp,which reads the dist-info/RECORD written by installer — the modern replacement
for the old
install_files.txtrecord mechanism.The
build/PY_BUILDtarget (used bymake check-buildandmake check)is unchanged — it still calls
setup.py buildwhich is not deprecated..github/actions/setup/action.ymlis updated to install the additionalPython build-time dependencies (
wheel,build,installer) alongside theexisting
cython.Testing
make install DESTDIR=/tmp/test prefix=/usr: zero deprecation warnings,seccomp.cpython-*.soandseccomp-*.dist-infocorrectly installed under${DESTDIR}/usr/lib/python*/site-packages/.make check-build,make check: both pass; thebuildtarget isunaffected by this change.
bash src/arch-syscall-check: PASS.