From: Ladislav Michl <oss-lists@triops.cz>
To: ptxdist@pengutronix.de
Subject: [ptxdist] [PATCH v3 08/18] python3-libselinux: new package
Date: Mon, 16 Nov 2026 08:26:28 +0100 [thread overview]
Message-ID: <20261116072639.3157459-9-oss-lists@triops.cz> (raw)
In-Reply-To: <20261116072639.3157459-1-oss-lists@triops.cz>
From: Ladislav Michl <ladis@triops.cz>
Python bindings for libselinux built as a separate package, because
python3 may depend on libselinux via util-linux, so libselinux itself
cannot depend on python3.
Signed-off-by: Ladislav Michl <ladis@triops.cz>
---
CHANGES:
- v3: new patch, python wrapper split out of libselinux. Built with
the standard python3 conf tool from libselinux's src/setup.py,
so .pyc files are generated and only those are installed.
rules/python3-libselinux.in | 12 +++++++
rules/python3-libselinux.make | 66 +++++++++++++++++++++++++++++++++++
2 files changed, 78 insertions(+)
create mode 100644 rules/python3-libselinux.in
create mode 100644 rules/python3-libselinux.make
diff --git a/rules/python3-libselinux.in b/rules/python3-libselinux.in
new file mode 100644
index 000000000..2ef916872
--- /dev/null
+++ b/rules/python3-libselinux.in
@@ -0,0 +1,12 @@
+## SECTION=selinux
+
+config PYTHON3_LIBSELINUX
+ tristate
+ prompt "python3-libselinux"
+ select LIBSELINUX
+ select LIBSEPOL
+ select PYTHON3
+ select HOST_SWIG
+ select HOST_PYTHON3_SETUPTOOLS
+ help
+ Python bindings for libselinux.
diff --git a/rules/python3-libselinux.make b/rules/python3-libselinux.make
new file mode 100644
index 000000000..b10e4a20f
--- /dev/null
+++ b/rules/python3-libselinux.make
@@ -0,0 +1,66 @@
+# -*-makefile-*-
+#
+# Copyright (C) 2026 by Ladislav Michl <ladis@triops.cz>
+#
+# For further information about the PTXdist project and license conditions
+# see the README file.
+#
+
+#
+# We provide this package
+#
+PACKAGES-$(PTXCONF_PYTHON3_LIBSELINUX) += python3-libselinux
+
+#
+# Paths and names
+#
+PYTHON3_LIBSELINUX_VERSION = $(LIBSELINUX_VERSION)
+PYTHON3_LIBSELINUX_SHA256 = $(LIBSELINUX_SHA256)
+PYTHON3_LIBSELINUX = python3-libselinux-$(PYTHON3_LIBSELINUX_VERSION)
+PYTHON3_LIBSELINUX_SUFFIX = $(LIBSELINUX_SUFFIX)
+PYTHON3_LIBSELINUX_URL = $(LIBSELINUX_URL)
+PYTHON3_LIBSELINUX_SOURCE = $(LIBSELINUX_SOURCE)
+PYTHON3_LIBSELINUX_DIR = $(BUILDDIR)/$(PYTHON3_LIBSELINUX)
+PYTHON3_LIBSELINUX_PATCHES = $(LIBSELINUX)
+PYTHON3_LIBSELINUX_LICENSE = $(LIBSELINUX_LICENSE)
+PYTHON3_LIBSELINUX_LICENSE_FILES = $(LIBSELINUX_LICENSE_FILES)
+
+# ----------------------------------------------------------------------------
+# Prepare
+# ----------------------------------------------------------------------------
+
+PYTHON3_LIBSELINUX_CONF_TOOL := python3
+PYTHON3_LIBSELINUX_SUBDIR := src
+
+# ----------------------------------------------------------------------------
+# Install
+# ----------------------------------------------------------------------------
+
+$(STATEDIR)/python3-libselinux.install:
+ @$(call targetinfo)
+# # swig generated module is not part of setup.py
+ @install -m 644 $(PYTHON3_LIBSELINUX_DIR)/src/selinux.py \
+ "$$(echo $(PYTHON3_LIBSELINUX_DIR)/src/build/lib.*/selinux)/__init__.py"
+ @$(call world/install, PYTHON3_LIBSELINUX)
+ @$(call touch)
+
+# ----------------------------------------------------------------------------
+# Target-Install
+# ----------------------------------------------------------------------------
+
+$(STATEDIR)/python3-libselinux.targetinstall:
+ @$(call targetinfo)
+
+ @$(call install_init, python3-libselinux)
+ @$(call install_fixup, python3-libselinux,PRIORITY,optional)
+ @$(call install_fixup, python3-libselinux,SECTION,base)
+ @$(call install_fixup, python3-libselinux,AUTHOR,"Ladislav Michl <ladis@triops.cz>")
+ @$(call install_fixup, python3-libselinux,DESCRIPTION,missing)
+
+ @$(call install_glob, python3-libselinux, 0, 0, -, $(PYTHON3_SITEPACKAGES),, *.py)
+
+ @$(call install_finish, python3-libselinux)
+
+ @$(call touch)
+
+# vim: syntax=make
--
2.47.3
next prev parent reply other threads:[~2026-11-16 7:53 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-16 7:26 [ptxdist] [PATCH v3 00/18] selinux: back at version 3.11 Ladislav Michl
2026-11-16 7:26 ` [ptxdist] [PATCH v3 01/18] selinux: add common version and URL Ladislav Michl
2026-11-16 7:26 ` [ptxdist] [PATCH v3 02/18] Revert "python: remove after more than one year in staging" Ladislav Michl
2026-11-16 7:26 ` [ptxdist] [PATCH v3 03/18] host-swig: version bump 4.0.1 -> 4.5.1 Ladislav Michl
2026-11-16 7:26 ` [ptxdist] [PATCH v3 04/18] Revert "*libsepol: remove" Ladislav Michl
2026-11-16 7:26 ` [ptxdist] [PATCH v3 05/18] libsepol: version bump 2.1.8 -> 3.11 Ladislav Michl
2026-11-16 7:26 ` [ptxdist] [PATCH v3 06/18] Revert "libselinux: remove after more than one year in staging" Ladislav Michl
2026-11-16 7:26 ` [ptxdist] [PATCH v3 07/18] libselinux: version bump 2.1.12 -> 3.11 Ladislav Michl
2026-11-16 7:26 ` Ladislav Michl [this message]
2026-11-16 7:26 ` [ptxdist] [PATCH v3 09/18] audit: new package Ladislav Michl
2026-11-16 7:26 ` [ptxdist] [PATCH v3 10/18] Revert "libsemanage: remove after more than one year in staging" Ladislav Michl
2026-11-16 7:26 ` [ptxdist] [PATCH v3 11/18] libsemanage: version bump 2.1.9 -> 3.11 Ladislav Michl
2026-11-16 7:26 ` [ptxdist] [PATCH v3 12/18] Revert "checkpolicy: remove after more than one year in staging" Ladislav Michl
2026-11-16 7:26 ` [ptxdist] [PATCH v3 13/18] checkpolicy: version bump 2.1.11 -> 3.11 Ladislav Michl
2026-11-16 7:26 ` [ptxdist] [PATCH v3 14/18] Revert "policycoreutils: remove after more than one year in staging" Ladislav Michl
2026-11-16 7:26 ` [ptxdist] [PATCH v3 15/18] policycoreutils: version bump 2.1.13 -> 3.11 Ladislav Michl
2026-11-16 7:26 ` [ptxdist] [PATCH v3 16/18] Revert "sepolgen: remove after one year in staging" Ladislav Michl
2026-11-16 7:26 ` [ptxdist] [PATCH v3 17/18] sepolgen: version bump 1.1.8 -> 3.11 Ladislav Michl
2026-11-16 7:26 ` [ptxdist] [PATCH v3 18/18] selinux: restore the global option Ladislav Michl
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261116072639.3157459-9-oss-lists@triops.cz \
--to=oss-lists@triops.cz \
--cc=ptxdist@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox