Skip to content

Conversation

@drakenclimber
Copy link
Member

@drakenclimber drakenclimber commented Jul 9, 2025

This patchset adds support for building Python wheels that are suitable for upload to pip.

I uploaded the wheels generated by the Ubuntu 24.04 continuous integration run to the Test PyPi pip repository. Note that I have not uploaded any wheels to the formal pip repository. (We'll likely need to create a seccomp organization in pip just like the seccomp organization in github.)

For local testing, I used the following commands on my machine:

./autogen.sh && ./configure --enable-python && make && make python-wheel
python3 -m pip install src/python/dist/*.whl [--force-reinstall]

The above commands will load the package into ~/.local/lib/{PYTHON_VERSION}/site-packages/. With the packages loaded into the local python repo, any python program on that machine (run by the same user) can utilize the newly-built packages. For example, I ran several built-in tests in the tests/ folder without updating the PYTHONPATH environment variable.

Rename setup.py to setup.py.in so that the version variables can be
autopopulated by automake/m4.

This will be used in subsequent commits for building python wheels.
Wheels are often built in containers, and the build containers don't
have knowledge of automake, its configurations, and its environment
variables, so we need to pre-populate the version information.

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Change the include of seccomp-syscalls.h from:
	#include <seccomp-syscalls.h>
to:
	#include "seccomp-syscalls.h

Change the include directive of seccomp-syscalls.h to be a local (rather
than system-wide) include.  This change is required for building python
wheels inside of containers where the system-wide include path will
likely not include the local path to seccomp-syscalls.h

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Add two new make targets:
	python-wheel:  build a python wheel for this system
	python-wheels: build the series of python wheels for pip

When building the wheels for pip, cibuildwheel utilizes Docker
containers.  Because of this, it cannot reach outside of the build
directory, src/python, so any files outside of this folder -
libseccomp.a, seccomp.h, etc. - must be copied into the src/python
folder.

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Add three python continuous integration jobs:
	build-wheel: Build a wheel for the native build system
	build-wheels: Build wheels suitable for uploading to pip
	flake: Python lint checker

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
@drakenclimber drakenclimber added this to the v2.7.0 milestone Jul 9, 2025
@drakenclimber drakenclimber requested a review from pcmoore July 9, 2025 19:56
@drakenclimber drakenclimber self-assigned this Jul 9, 2025
@coveralls
Copy link

Coverage Status

coverage: 89.046%. remained the same
when pulling c6483a3 on drakenclimber:python-wheel2
into 5491c4b on seccomp:main.

@echo " dist-gzip: build a release tarball"
@echo " coverity-tarball: build a tarball for use with Coverity (opt)"
@echo " python-wheel: build a python wheel for this system"
@echo " python-wheels: build python wheels for distribution to pip"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it's just me, but I'm fairly certain I'm going to be forever typing the wrong target as they only differ in that plural 's' at the end; would changing python-wheels to python-wheels-pip be reasonable?

# Enhanced Seccomp Library Python Module Build Script
#
# Copyright (c) 2012 Red Hat <pmoore@redhat.com>
# Copyright (c) 2012-2025 Red Hat <pmoore@redhat.com>
Copy link
Member

@pcmoore pcmoore Oct 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo? Did you mean to add a line for you/Oracle?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants