* [PATCH] adjust audit2why map for python2 and 3
@ 2026-05-07 9:52 Pepper Gray
2026-05-28 13:53 ` Petr Lautrbach
0 siblings, 1 reply; 3+ messages in thread
From: Pepper Gray @ 2026-05-07 9:52 UTC (permalink / raw)
To: selinux
From 3cd62189af93997ab5ff58684352af38900c7758 Mon Sep 17 00:00:00 2001
From: Pepper Gray <hello@peppergray.xyz>
Date: Sat, 11 Apr 2026 19:33:07 +0200
Subject: [PATCH] adjust audit2why map for python2 and 3
align conditional python symbols creation and export
fix: #461
Signed-off-by: Pepper Gray <hello@peppergray.xyz>
---
libselinux/src/audit2why-py2.map | 5 +++++
libselinux/src/audit2why-py3.map | 5 +++++
libselinux/src/setup.py | 16 +++++++++++++---
3 files changed, 23 insertions(+), 3 deletions(-)
create mode 100644 libselinux/src/audit2why-py2.map
create mode 100644 libselinux/src/audit2why-py3.map
diff --git a/libselinux/src/audit2why-py2.map b/libselinux/src/audit2why-py2.map
new file mode 100644
index 0000000000..249f0beb3b
--- /dev/null
+++ b/libselinux/src/audit2why-py2.map
@@ -0,0 +1,5 @@
+AUDIT2WHY_2.9 {
+ global:
+ initaudit2why;
+ local: *;
+};
diff --git a/libselinux/src/audit2why-py3.map b/libselinux/src/audit2why-py3.map
new file mode 100644
index 0000000000..e99b8d7688
--- /dev/null
+++ b/libselinux/src/audit2why-py3.map
@@ -0,0 +1,5 @@
+AUDIT2WHY_2.9 {
+ global:
+ PyInit_audit2why;
+ local: *;
+};
diff --git a/libselinux/src/setup.py b/libselinux/src/setup.py
index 679ea43f8b..9201448f0e 100644
--- a/libselinux/src/setup.py
+++ b/libselinux/src/setup.py
@@ -1,11 +1,21 @@
-#!/usr/bin/python3
+#!/usr/bin/env python
+import sys
from setuptools import Extension, setup
+PY_MAJOR_VERSION = sys.version_info[0]
+
+if PY_MAJOR_VERSION >= 3:
+ audit2why_map = "audit2why-py3.map"
+ description = "SELinux python 3 bindings"
+else:
+ audit2why_map = "audit2why-py2.map"
+ description = "SELinux python 2 bindings"
+
setup(
name="selinux",
version="3.10",
- description="SELinux python 3 bindings",
+ description=description,
author="SELinux Project",
author_email="selinux@vger.kernel.org",
ext_modules=[
@@ -19,6 +29,6 @@
include_dirs=['../include'],
library_dirs=['.'],
libraries=['selinux'],
- extra_link_args=['-l:libsepol.a',
'-Wl,--version-script=audit2why.map'])
+ extra_link_args=['-l:libsepol.a',
"-Wl,--version-script={}".format(audit2why_map])
],
)
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] adjust audit2why map for python2 and 3
2026-05-07 9:52 [PATCH] adjust audit2why map for python2 and 3 Pepper Gray
@ 2026-05-28 13:53 ` Petr Lautrbach
[not found] ` <CAHLDejyUiLXZBKhGFpZZxP+k3CCaTL0bPA_xhonYc6pXvOsx6A@mail.gmail.com>
0 siblings, 1 reply; 3+ messages in thread
From: Petr Lautrbach @ 2026-05-28 13:53 UTC (permalink / raw)
To: Pepper Gray, selinux
Pepper Gray <hello@peppergray.xyz> writes:
> From 3cd62189af93997ab5ff58684352af38900c7758 Mon Sep 17 00:00:00 2001
> From: Pepper Gray <hello@peppergray.xyz>
> Date: Sat, 11 Apr 2026 19:33:07 +0200
> Subject: [PATCH] adjust audit2why map for python2 and 3
>
> align conditional python symbols creation and export
>
> fix: #461
> Signed-off-by: Pepper Gray <hello@peppergray.xyz>
Please use `git send-email` to send patches next time.
Python 2 is not supported in this project since SELinux userspace release 20191204 / 3.0
Python 2 EOL was January 2020.
Petr
> ---
> libselinux/src/audit2why-py2.map | 5 +++++
> libselinux/src/audit2why-py3.map | 5 +++++
> libselinux/src/setup.py | 16 +++++++++++++---
> 3 files changed, 23 insertions(+), 3 deletions(-)
> create mode 100644 libselinux/src/audit2why-py2.map
> create mode 100644 libselinux/src/audit2why-py3.map
>
> diff --git a/libselinux/src/audit2why-py2.map b/libselinux/src/audit2why-py2.map
> new file mode 100644
> index 0000000000..249f0beb3b
> --- /dev/null
> +++ b/libselinux/src/audit2why-py2.map
> @@ -0,0 +1,5 @@
> +AUDIT2WHY_2.9 {
> + global:
> + initaudit2why;
> + local: *;
> +};
> diff --git a/libselinux/src/audit2why-py3.map b/libselinux/src/audit2why-py3.map
> new file mode 100644
> index 0000000000..e99b8d7688
> --- /dev/null
> +++ b/libselinux/src/audit2why-py3.map
> @@ -0,0 +1,5 @@
> +AUDIT2WHY_2.9 {
> + global:
> + PyInit_audit2why;
> + local: *;
> +};
> diff --git a/libselinux/src/setup.py b/libselinux/src/setup.py
> index 679ea43f8b..9201448f0e 100644
> --- a/libselinux/src/setup.py
> +++ b/libselinux/src/setup.py
> @@ -1,11 +1,21 @@
> -#!/usr/bin/python3
> +#!/usr/bin/env python
>
> +import sys
> from setuptools import Extension, setup
>
> +PY_MAJOR_VERSION = sys.version_info[0]
> +
> +if PY_MAJOR_VERSION >= 3:
> + audit2why_map = "audit2why-py3.map"
> + description = "SELinux python 3 bindings"
> +else:
> + audit2why_map = "audit2why-py2.map"
> + description = "SELinux python 2 bindings"
> +
> setup(
> name="selinux",
> version="3.10",
> - description="SELinux python 3 bindings",
> + description=description,
> author="SELinux Project",
> author_email="selinux@vger.kernel.org",
> ext_modules=[
> @@ -19,6 +29,6 @@
> include_dirs=['../include'],
> library_dirs=['.'],
> libraries=['selinux'],
> - extra_link_args=['-l:libsepol.a',
> '-Wl,--version-script=audit2why.map'])
> + extra_link_args=['-l:libsepol.a',
> "-Wl,--version-script={}".format(audit2why_map])
> ],
> )
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-05-29 10:31 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-07 9:52 [PATCH] adjust audit2why map for python2 and 3 Pepper Gray
2026-05-28 13:53 ` Petr Lautrbach
[not found] ` <CAHLDejyUiLXZBKhGFpZZxP+k3CCaTL0bPA_xhonYc6pXvOsx6A@mail.gmail.com>
2026-05-29 10:31 ` github Issues and PR Petr Lautrbach
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.