python: Remove dependency on the Python module distutils

The distutils package is deprecated and scheduled to be removed in
Python 3.12. Use the setuptools and sysconfig modules instead.

Signed-off-by: James Carter <jwcart2@gmail.com>
Acked-by: Petr Lautrbach <plautrba@redhat.com>
This commit is contained in:
James Carter 2022-10-28 16:16:22 -04:00
parent 33e56c9b2e
commit c08cf24f39
4 changed files with 5 additions and 5 deletions

View file

@ -5,7 +5,7 @@ LINGUAS ?= ru
PREFIX ?= /usr PREFIX ?= /usr
SBINDIR ?= $(PREFIX)/sbin SBINDIR ?= $(PREFIX)/sbin
MANDIR = $(PREFIX)/share/man MANDIR = $(PREFIX)/share/man
PYTHONLIBDIR ?= $(shell $(PYTHON) -c "from distutils.sysconfig import *; print(get_python_lib(prefix='$(PREFIX)'))") PYTHONLIBDIR ?= $(shell $(PYTHON) -c "import sysconfig; print(sysconfig.get_path('purelib', vars={'platbase': '$(PREFIX)', 'base': '$(PREFIX)'}))")
PACKAGEDIR ?= $(PYTHONLIBDIR) PACKAGEDIR ?= $(PYTHONLIBDIR)
BASHCOMPLETIONDIR ?= $(PREFIX)/share/bash-completion/completions BASHCOMPLETIONDIR ?= $(PREFIX)/share/bash-completion/completions

View file

@ -1,6 +1,6 @@
PREFIX ?= /usr PREFIX ?= /usr
PYTHON ?= python3 PYTHON ?= python3
PYTHONLIBDIR ?= $(shell $(PYTHON) -c "from distutils.sysconfig import *; print(get_python_lib(prefix='$(PREFIX)'))") PYTHONLIBDIR ?= $(shell $(PYTHON) -c "import sysconfig; print(sysconfig.get_path('purelib', vars={'platbase': '$(PREFIX)', 'base': '$(PREFIX)'}))")
PACKAGEDIR ?= /$(PYTHONLIBDIR)/sepolgen PACKAGEDIR ?= /$(PYTHONLIBDIR)/sepolgen
all: all:

View file

@ -77,7 +77,7 @@ def cmp(a, b):
return 1 return 1
return (a > b) - (a < b) return (a > b) - (a < b)
import distutils.sysconfig import sysconfig
ADVANCED_LABEL = (_("Advanced >>"), _("Advanced <<")) ADVANCED_LABEL = (_("Advanced >>"), _("Advanced <<"))
ADVANCED_SEARCH_LABEL = (_("Advanced Search >>"), _("Advanced Search <<")) ADVANCED_SEARCH_LABEL = (_("Advanced Search >>"), _("Advanced Search <<"))
OUTBOUND_PAGE = 0 OUTBOUND_PAGE = 0
@ -130,7 +130,7 @@ class SELinuxGui():
self.application = app self.application = app
self.filter_txt = "" self.filter_txt = ""
builder = Gtk.Builder() # BUILDER OBJ builder = Gtk.Builder() # BUILDER OBJ
self.code_path = distutils.sysconfig.get_python_lib(plat_specific=False) + "/sepolicy/" self.code_path = sysconfig.get_python_lib(plat_specific=False) + "/sepolicy/"
glade_file = self.code_path + "sepolicy.glade" glade_file = self.code_path + "sepolicy.glade"
builder.add_from_file(glade_file) builder.add_from_file(glade_file)
self.outer_notebook = builder.get_object("outer_notebook") self.outer_notebook = builder.get_object("outer_notebook")

View file

@ -2,7 +2,7 @@
# Author: Thomas Liu <tliu@redhat.com> # Author: Thomas Liu <tliu@redhat.com>
# Author: Dan Walsh <dwalsh@redhat.com> # Author: Dan Walsh <dwalsh@redhat.com>
from distutils.core import setup from setuptools import setup
setup( setup(
name="sepolicy", name="sepolicy",