All of lore.kernel.org
 help / color / mirror / Atom feed
From: Petr Lautrbach <plautrba@redhat.com>
To: James Carter <jwcart2@gmail.com>, selinux@vger.kernel.org
Cc: James Carter <jwcart2@gmail.com>
Subject: Re: [PATCH 3/5] python: Remove dependency on the Python module distutils
Date: Tue, 01 Nov 2022 09:59:50 +0100	[thread overview]
Message-ID: <87v8nzrqwp.fsf@redhat.com> (raw)
In-Reply-To: <20221028203852.526472-4-jwcart2@gmail.com>

James Carter <jwcart2@gmail.com> writes:

> 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>
> ---
>  python/semanage/Makefile              | 2 +-
>  python/sepolgen/src/sepolgen/Makefile | 2 +-
>  python/sepolicy/sepolicy/gui.py       | 2 +-
>  python/sepolicy/setup.py              | 2 +-
>  4 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/python/semanage/Makefile b/python/semanage/Makefile
> index 024e9640..b1f1bd3a 100644
> --- a/python/semanage/Makefile
> +++ b/python/semanage/Makefile
> @@ -5,7 +5,7 @@ LINGUAS ?= ru
>  PREFIX ?= /usr
>  SBINDIR ?= $(PREFIX)/sbin
>  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('platlib', vars={'platbase': '$(PREFIX)', 'base': '$(PREFIX)'}))")

$ python3 -c "from distutils.sysconfig import *; print(get_python_lib(prefix='/usr'))"     
/usr/lib/python3.10/site-packages

vs

$ python3 -c "import sysconfig; print(sysconfig.get_path('platlib', vars={'platbase': '/usr', 'base': '/usr'}))"
/usr/lib64/python3.10/site-packages

Given that python/ is not platform specific this should use 'purelib' -
https://docs.python.org/3/library/sysconfig.html#installation-paths

$ python3 -c "import sysconfig; print(sysconfig.get_path('purelib', vars={'platbase': '/usr', 'base': '/usr'}))"
/usr/lib/python3.10/site-packages




>  PACKAGEDIR ?= $(PYTHONLIBDIR)
>  BASHCOMPLETIONDIR ?= $(PREFIX)/share/bash-completion/completions
>  
> diff --git a/python/sepolgen/src/sepolgen/Makefile b/python/sepolgen/src/sepolgen/Makefile
> index cac8def7..9578af23 100644
> --- a/python/sepolgen/src/sepolgen/Makefile
> +++ b/python/sepolgen/src/sepolgen/Makefile
> @@ -1,6 +1,6 @@
>  PREFIX ?= /usr
>  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('platlib', vars={'platbase': '$(PREFIX)', 'base': '$(PREFIX)'}))")
>  PACKAGEDIR ?= /$(PYTHONLIBDIR)/sepolgen
>  
>  all:
> diff --git a/python/sepolicy/sepolicy/gui.py b/python/sepolicy/sepolicy/gui.py
> index 5bdbfeba..63f2371f 100644
> --- a/python/sepolicy/sepolicy/gui.py
> +++ b/python/sepolicy/sepolicy/gui.py
> @@ -77,7 +77,7 @@ def cmp(a, b):
>          return 1
>      return (a > b) - (a < b)
>  
> -import distutils.sysconfig
> +import sysconfig
>  ADVANCED_LABEL = (_("Advanced >>"), _("Advanced <<"))
>  ADVANCED_SEARCH_LABEL = (_("Advanced Search >>"), _("Advanced Search <<"))
>  OUTBOUND_PAGE = 0
> diff --git a/python/sepolicy/setup.py b/python/sepolicy/setup.py
> index b0f9650d..c8220664 100644
> --- a/python/sepolicy/setup.py
> +++ b/python/sepolicy/setup.py
> @@ -2,7 +2,7 @@
>  
>  # Author: Thomas Liu <tliu@redhat.com>
>  # Author: Dan Walsh <dwalsh@redhat.com>
> -from distutils.core import setup
> +from setuptools import setup
>  
>  setup(
>      name="sepolicy",
> -- 
> 2.37.3


  reply	other threads:[~2022-11-01  9:01 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-28 20:38 [PATCH 0/5] Remove dependency on the Python module distutils James Carter
2022-10-28 20:38 ` [PATCH 1/5] libselinux: " James Carter
2022-10-28 20:38 ` [PATCH 2/5] libsemanage: " James Carter
2022-10-28 20:38 ` [PATCH 3/5] python: " James Carter
2022-11-01  8:59   ` Petr Lautrbach [this message]
2022-11-01 12:08     ` James Carter
2022-10-28 20:38 ` [PATCH 4/5] scripts: " James Carter
2022-10-28 20:38 ` [PATCH 5/5] README.md: Remove mention of python3-distutils dependency James Carter
2022-10-31 12:49 ` [PATCH 0/5] Remove dependency on the Python module distutils Petr Lautrbach
  -- strict thread matches above, loose matches on Subject: below --
2022-11-04 14:36 [PATCH 0/5 v3] " James Carter
2022-11-04 14:36 ` [PATCH 3/5] python: " James Carter

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=87v8nzrqwp.fsf@redhat.com \
    --to=plautrba@redhat.com \
    --cc=jwcart2@gmail.com \
    --cc=selinux@vger.kernel.org \
    /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 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.