4c7a363
From 6862fbced61b192980b804927f98a8dc568630a5 Mon Sep 17 00:00:00 2001
4c7a363
From: John Kacur <jkacur@redhat.com>
4c7a363
Date: Thu, 16 Feb 2023 11:03:59 -0500
4c7a363
Subject: [PATCH] python_linux_procfs: setup.py: Remove distutils
4c7a363
4c7a363
distutils is deprecated, so use sysconfig instead
4c7a363
4c7a363
different versions of python produce different results, which is why
4c7a363
we test which SCHEME is available before calculating our answer.
4c7a363
4c7a363
TODO: test whether we need to calculate PYTHONLIB at all. Is it being
4c7a363
used during the setup? We don't appear to be using a --prefix from our
4c7a363
specfiles. This patch ensures that if it is used, we are getting a
4c7a363
correct PYTHONLIB without using distutils, but perhaps we can just drop
4c7a363
this section.
4c7a363
4c7a363
We need to bump the version number as well here, it looks like it was
4c7a363
missed the last time.
4c7a363
4c7a363
Signed-off-by: John Kacur <jkacur@redhat.com>
4c7a363
---
4c7a363
 setup.py | 12 ++++++++----
4c7a363
 1 file changed, 8 insertions(+), 4 deletions(-)
4c7a363
4c7a363
diff --git a/setup.py b/setup.py
4c7a363
index 0ee543487c31..92e6363abb4b 100755
4c7a363
--- a/setup.py
4c7a363
+++ b/setup.py
4c7a363
@@ -1,17 +1,21 @@
4c7a363
 #!/usr/bin/python3
4c7a363
 import os
4c7a363
-from os.path import isfile, join
4c7a363
-from distutils.sysconfig import get_python_lib
4c7a363
+from os.path import isfile, relpath
4c7a363
+import sysconfig
4c7a363
 from setuptools import setup
4c7a363
 
4c7a363
 if isfile("MANIFEST"):
4c7a363
     os.unlink("MANIFEST")
4c7a363
 
4c7a363
+SCHEME = 'rpm_prefix'
4c7a363
+if not SCHEME in sysconfig.get_scheme_names():
4c7a363
+    SCHEME = 'posix_prefix'
4c7a363
+
4c7a363
 # Get PYTHONLIB with no prefix so --prefix installs work.
4c7a363
-PYTHONLIB = join(get_python_lib(standard_lib=1, prefix=''), 'site-packages')
4c7a363
+PYTHONLIB = relpath(sysconfig.get_path('platlib', SCHEME), '/usr')
4c7a363
 
4c7a363
 setup(name="python-linux-procfs",
4c7a363
-    version = "0.7.0",
4c7a363
+    version = "0.7.1",
4c7a363
     description = "Linux /proc abstraction classes",
4c7a363
     author = "Arnaldo Carvalho de Melo",
4c7a363
     author_email = "acme@redhat.com",
4c7a363
-- 
4c7a363
2.39.1
4c7a363