* [PATCH 12/14] rteval: Use sysconfig instead of deprecated distutils
2023-02-21 19:58 [ANNOUNCE] *** rteval-3.6 *** John Kacur
@ 2023-02-21 19:58 ` John Kacur
2023-02-21 19:58 ` [PATCH 13/14] rteval: setup: Remove distutils and clean-ups John Kacur
2023-02-21 19:58 ` [PATCH 14/14] rteval: Update version number to v3.6 John Kacur
2 siblings, 0 replies; 4+ messages in thread
From: John Kacur @ 2023-02-21 19:58 UTC (permalink / raw)
To: RT; +Cc: Clark Williams, Kate Carcia Poulin, John Kacur
Use sysconfig instead of deprecated distutils to add the
rteval directory to the module search path.
Signed-off-by: John Kacur <jkacur@redhat.com>
---
rteval/__init__.py | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/rteval/__init__.py b/rteval/__init__.py
index d8127425febe..a245ef935568 100644
--- a/rteval/__init__.py
+++ b/rteval/__init__.py
@@ -37,7 +37,7 @@ import sys
import threading
import time
from datetime import datetime
-from distutils import sysconfig
+import sysconfig
from rteval.modules.loads import LoadModules
from rteval.modules.measurement import MeasurementModules, MeasurementProfile
from rteval.rtevalReport import rtevalReport
@@ -99,7 +99,12 @@ class RtEval(rtevalReport):
raise RuntimeError(f"can't find XSL template ({self.__rtevcfg.xslt_report})!")
# Add rteval directory into module search path
- sys.path.insert(0, f'{sysconfig.get_python_lib()}/rteval')
+ scheme = 'rpm_prefix'
+ if scheme not in sysconfig.get_scheme_names():
+ scheme = 'posix_prefix'
+ pypath = f"{sysconfig.get_path('platlib', scheme)}/rteval"
+ sys.path.insert(0, pypath)
+ self.__logger.log(Log.DEBUG, f"Adding {pypath} to search path")
# Initialise the report module
rtevalReport.__init__(self, self.__version,
--
2.39.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 13/14] rteval: setup: Remove distutils and clean-ups
2023-02-21 19:58 [ANNOUNCE] *** rteval-3.6 *** John Kacur
2023-02-21 19:58 ` [PATCH 12/14] rteval: Use sysconfig instead of deprecated distutils John Kacur
@ 2023-02-21 19:58 ` John Kacur
2023-02-21 19:58 ` [PATCH 14/14] rteval: Update version number to v3.6 John Kacur
2 siblings, 0 replies; 4+ messages in thread
From: John Kacur @ 2023-02-21 19:58 UTC (permalink / raw)
To: RT; +Cc: Clark Williams, Kate Carcia Poulin, John Kacur
Replace deprecated distutils with sysconfig and setuptools
Clean-up a few other things in the file at the same time, such as the
incorrect outdated git url.
Signed-off-by: John Kacur <jkacur@redhat.com>
---
setup.py | 27 +++++++++++++++------------
1 file changed, 15 insertions(+), 12 deletions(-)
diff --git a/setup.py b/setup.py
index 9a76ffbf89be..bcf7330553d4 100644
--- a/setup.py
+++ b/setup.py
@@ -1,12 +1,18 @@
#!/usr/bin/python3
-from distutils.sysconfig import get_python_lib
-from distutils.core import setup
-from os.path import isfile, join
-import glob, os, shutil, gzip
+""" install rteval """
+import sysconfig
+from os.path import relpath
+import os
+import shutil
+import gzip
+from setuptools import setup
# Get PYTHONLIB with no prefix so --prefix installs work.
-PYTHONLIB = join(get_python_lib(standard_lib=1, prefix=''), 'site-packages')
+SCHEME = 'rpm_prefix'
+if SCHEME not in sysconfig.get_scheme_names():
+ SCHEME = 'posix_prefix'
+PYTHONLIB = relpath(sysconfig.get_path('platlib', SCHEME), '/usr')
# Tiny hack to make rteval-cmd become a rteval when building/installing the package
try:
@@ -28,19 +34,18 @@ from dist import RTEVAL_VERSION
# Compress the man page, so distutil will only care for the compressed file
mangz = gzip.GzipFile('dist/rteval.8.gz', 'w', 9)
-man = open('doc/rteval.8', 'rb')
-mangz.writelines(man)
-man.close()
+with open('doc/rteval.8', 'rb') as man:
+ mangz.writelines(man)
mangz.close()
-# Do the distutils stuff
+# Do the setup stuff
setup(name="rteval",
version = RTEVAL_VERSION,
description = "Evaluate system performance for Realtime",
author = "Clark Williams, David Sommerseth",
author_email = "williams@redhat.com, davids@redhat.com",
- url = "https://git.kernel.org/?p=linux/kernel/git/clrkwllms/rteval.git;a=summary",
+ url = "https://git.kernel.org/pub/scm/utils/rteval/rteval.git",
license = "GPLv2",
long_description =
"""\
@@ -79,8 +84,6 @@ mean, variance and standard deviation) and a report is generated.
os.unlink('dist/rteval')
os.unlink('dist/rteval.8.gz')
os.unlink('dist/__init__.py')
-# TODO FIX THIS, or at least find out why it was there
-#os.unlink('dist/__init__.pyc')
if distcreated:
try:
--
2.39.1
^ permalink raw reply related [flat|nested] 4+ messages in thread