Added patches to use f-strings where possible, no functional change
jiraProject== RHEL-798 Signed-off-by: John Kacur <jkacur@redhat.com>
This commit is contained in:
parent
487a77c935
commit
af17fc22fd
42
rteval-Log.py-Convert-to-f-strings.patch
Normal file
42
rteval-Log.py-Convert-to-f-strings.patch
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
From 78bd089e89e15b09db8e1d2bdcc0d9620d4da03c Mon Sep 17 00:00:00 2001
|
||||||
|
From: John Kacur <jkacur@redhat.com>
|
||||||
|
Date: Tue, 6 Dec 2022 14:44:44 -0500
|
||||||
|
Subject: rteval: Log.py: Convert to f-strings
|
||||||
|
|
||||||
|
Convert Log.py to f-strings
|
||||||
|
|
||||||
|
Signed-off-by: John Kacur <jkacur@redhat.com>
|
||||||
|
---
|
||||||
|
rteval/Log.py | 9 +++------
|
||||||
|
1 file changed, 3 insertions(+), 6 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/rteval/Log.py b/rteval/Log.py
|
||||||
|
index 63ca3b8681f8..8d08ab3e210a 100644
|
||||||
|
--- a/rteval/Log.py
|
||||||
|
+++ b/rteval/Log.py
|
||||||
|
@@ -60,10 +60,7 @@ class Log:
|
||||||
|
|
||||||
|
def log(self, logtype, msg):
|
||||||
|
if (logtype & self.__logverb) or logtype == self.ALWAYS:
|
||||||
|
- self.__logfile.write("%s%s\n" %
|
||||||
|
- (self.__logtype_str(logtype),
|
||||||
|
- msg)
|
||||||
|
- )
|
||||||
|
+ self.__logfile.write(f"{self.__logtype_str(logtype)}{msg}\n")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@@ -80,8 +77,8 @@ def unit_test(rootdir):
|
||||||
|
def run_log_test(l):
|
||||||
|
for lt in range(min(logtypes), max(logtypes)*2):
|
||||||
|
test = ", ".join([logtypes_s[logtypes.index(i)] for i in [p for p in takewhile(lambda x: x <= lt, (2**i for i in count())) if p & lt]])
|
||||||
|
- print("Testing verbosity flags set to: (%i) %s" % (lt, test))
|
||||||
|
- msg = "Log entry when verbosity is set to %i [%s]" % (lt, test)
|
||||||
|
+ print(f"Testing verbosity flags set to: ({lt}) {test}")
|
||||||
|
+ msg = f"Log entry when verbosity is set to {lt} [{test}]"
|
||||||
|
l.SetLogVerbosity(lt)
|
||||||
|
test_log(l, msg)
|
||||||
|
print("-"*20)
|
||||||
|
--
|
||||||
|
2.40.1
|
||||||
|
|
31
rteval-Use-f-strings-in-cputopology.patch
Normal file
31
rteval-Use-f-strings-in-cputopology.patch
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
From c8f7457cfb23b595bdd3f500dc1c9790c7302dd3 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Anubhav Shelat <ashelat@redhat.com>
|
||||||
|
Date: Thu, 1 Jun 2023 16:27:29 -0400
|
||||||
|
Subject: rteval: Use f-strings in cputopology
|
||||||
|
|
||||||
|
Use f-strings in cputopology
|
||||||
|
|
||||||
|
Signed-off-by: Anubhav Shelat <ashelat@redhat.com>
|
||||||
|
Signed-off-by: John Kacur <jkacur@redhat.com>
|
||||||
|
---
|
||||||
|
rteval/sysinfo/cputopology.py | 4 +---
|
||||||
|
1 file changed, 1 insertion(+), 3 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/rteval/sysinfo/cputopology.py b/rteval/sysinfo/cputopology.py
|
||||||
|
index ced7e1f295b7..2bb632312320 100644
|
||||||
|
--- a/rteval/sysinfo/cputopology.py
|
||||||
|
+++ b/rteval/sysinfo/cputopology.py
|
||||||
|
@@ -124,9 +124,7 @@ def unit_test(rootdir):
|
||||||
|
x.saveFormatFileEnc('-', 'UTF-8', 1)
|
||||||
|
|
||||||
|
print(" ---- getCPUcores() / getCPUscokets() ---- ")
|
||||||
|
- print("CPU cores: %i (online: %i) - CPU sockets: %i" % (cputop.cpu_getCores(False),
|
||||||
|
- cputop.cpu_getCores(True),
|
||||||
|
- cputop.cpu_getSockets()))
|
||||||
|
+ print(f"CPU cores: {cputop.cpu_getCores(False)} (online: {cputop.cpu_getCores(True)}) - CPU sockets: {cputop.cpu_getSockets()}")
|
||||||
|
return 0
|
||||||
|
except Exception as e:
|
||||||
|
# import traceback
|
||||||
|
--
|
||||||
|
2.40.1
|
||||||
|
|
31
rteval-Use-f-strings-in-kernel.py.patch
Normal file
31
rteval-Use-f-strings-in-kernel.py.patch
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
From a4acd156917024303f326dd5e66a7c9e2d12fda3 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Anubhav Shelat <ashelat@redhat.com>
|
||||||
|
Date: Thu, 1 Jun 2023 16:27:30 -0400
|
||||||
|
Subject: rteval: Use f-strings in kernel.py
|
||||||
|
|
||||||
|
Use f-strings in kernel.py
|
||||||
|
|
||||||
|
Signed-off-by: Anubhav Shelat <ashelat@redhat.com>
|
||||||
|
Signed-off-by: John Kacur <jkacur@redhat.com>
|
||||||
|
---
|
||||||
|
rteval/sysinfo/kernel.py | 4 ++--
|
||||||
|
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/rteval/sysinfo/kernel.py b/rteval/sysinfo/kernel.py
|
||||||
|
index f2e9d72ac2ef..ba5cadda40c5 100644
|
||||||
|
--- a/rteval/sysinfo/kernel.py
|
||||||
|
+++ b/rteval/sysinfo/kernel.py
|
||||||
|
@@ -47,8 +47,8 @@ class KernelInfo:
|
||||||
|
policies = {'DLN': 'deadline', 'FF':'fifo', 'RR':'rrobin', 'TS':'other', '?':'unknown'}
|
||||||
|
ret_kthreads = {}
|
||||||
|
self.__log(Log.DEBUG, "getting kthread status")
|
||||||
|
- cmd = '%s -eocommand,pid,policy,rtprio,comm' % getcmdpath('ps')
|
||||||
|
- self.__log(Log.DEBUG, "cmd: %s" % cmd)
|
||||||
|
+ cmd = f"{getcmdpath('ps')} -eocommand,pid,policy,rtprio,comm"
|
||||||
|
+ self.__log(Log.DEBUG, f"cmd: {cmd}")
|
||||||
|
c = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE)
|
||||||
|
for p in c.stdout:
|
||||||
|
v = p.strip().split()
|
||||||
|
--
|
||||||
|
2.40.1
|
||||||
|
|
49
rteval-Use-f-strings-in-memory.py.patch
Normal file
49
rteval-Use-f-strings-in-memory.py.patch
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
From 6e063353072b73e43a732bb5dfa265767ac0dbd7 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Anubhav Shelat <ashelat@redhat.com>
|
||||||
|
Date: Thu, 1 Jun 2023 16:27:31 -0400
|
||||||
|
Subject: rteval: Use f-strings in memory.py
|
||||||
|
|
||||||
|
Use f-strings in memory.py
|
||||||
|
|
||||||
|
Signed-off-by: Anubhav Shelat <ashelat@redhat.com>
|
||||||
|
Signed-off-by: John Kacur <jkacur@redhat.com>
|
||||||
|
---
|
||||||
|
rteval/sysinfo/memory.py | 8 ++++----
|
||||||
|
1 file changed, 4 insertions(+), 4 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/rteval/sysinfo/memory.py b/rteval/sysinfo/memory.py
|
||||||
|
index 7c5fd6f315cf..cc2fa2cfa4be 100644
|
||||||
|
--- a/rteval/sysinfo/memory.py
|
||||||
|
+++ b/rteval/sysinfo/memory.py
|
||||||
|
@@ -49,7 +49,7 @@ class MemoryInfo:
|
||||||
|
if l.startswith('MemTotal:'):
|
||||||
|
parts = l.split()
|
||||||
|
if parts[2].lower() != 'kb':
|
||||||
|
- raise RuntimeError("Units changed from kB! (%s)" % parts[2])
|
||||||
|
+ raise RuntimeError(f"Units changed from kB! ({parts[2]})")
|
||||||
|
rawsize = int(parts[1])
|
||||||
|
f.close()
|
||||||
|
break
|
||||||
|
@@ -76,7 +76,7 @@ class MemoryInfo:
|
||||||
|
|
||||||
|
memsize = self.mem_get_size()
|
||||||
|
mem_n = libxml2.newNode("memory_size")
|
||||||
|
- mem_n.addContent("%.3f" % memsize[0])
|
||||||
|
+ mem_n.addContent(f"{memsize[0]:.3f}")
|
||||||
|
mem_n.newProp("unit", memsize[1])
|
||||||
|
rep_n.addChild(mem_n)
|
||||||
|
|
||||||
|
@@ -88,8 +88,8 @@ def unit_test(rootdir):
|
||||||
|
import sys
|
||||||
|
try:
|
||||||
|
mi = MemoryInfo()
|
||||||
|
- print("Numa nodes: %i" % mi.mem_get_numa_nodes())
|
||||||
|
- print("Memory: %i %s" % mi.mem_get_size())
|
||||||
|
+ print(f"Numa nodes: {mi.mem_get_numa_nodes()}")
|
||||||
|
+ print(f"Memory: {int(mi.mem_get_size()[0])} {mi.mem_get_size()[1]}")
|
||||||
|
except Exception as e:
|
||||||
|
import traceback
|
||||||
|
traceback.print_exc(file=sys.stdout)
|
||||||
|
--
|
||||||
|
2.40.1
|
||||||
|
|
61
rteval-Use-f-strings-in-osinfo.patch
Normal file
61
rteval-Use-f-strings-in-osinfo.patch
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
From f821e5f2daf595838395d80ba89ee5699076daf1 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Anubhav Shelat <ashelat@redhat.com>
|
||||||
|
Date: Thu, 1 Jun 2023 16:27:32 -0400
|
||||||
|
Subject: rteval: Use f-strings in osinfo
|
||||||
|
|
||||||
|
Use f-strings in osinfo.py
|
||||||
|
|
||||||
|
Signed-off-by: Anubhav Shelat <ashelat@redhat.com>
|
||||||
|
Signed-off-by: John Kacur <jkacur@redhat.com>
|
||||||
|
---
|
||||||
|
rteval/sysinfo/osinfo.py | 12 ++++++------
|
||||||
|
1 file changed, 6 insertions(+), 6 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/rteval/sysinfo/osinfo.py b/rteval/sysinfo/osinfo.py
|
||||||
|
index ead5e3939cfa..83dc78b96fdd 100644
|
||||||
|
--- a/rteval/sysinfo/osinfo.py
|
||||||
|
+++ b/rteval/sysinfo/osinfo.py
|
||||||
|
@@ -55,9 +55,9 @@ class OSInfo:
|
||||||
|
shutil.copyfile(dpath, os.path.join(repdir, "dmesg"))
|
||||||
|
return
|
||||||
|
if os.path.exists('/usr/bin/dmesg'):
|
||||||
|
- subprocess.call('/usr/bin/dmesg > %s' % os.path.join(repdir, "dmesg"), shell=True)
|
||||||
|
+ subprocess.call(f'/usr/bin/dmesg > {os.path.join(repdir, "dmesg")}', shell=True)
|
||||||
|
return
|
||||||
|
- print("dmesg file not found at %s and no dmesg exe found!" % dpath)
|
||||||
|
+ print(f"dmesg file not found at {dpath} and no dmesg exe found!")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@@ -69,16 +69,16 @@ class OSInfo:
|
||||||
|
else:
|
||||||
|
raise RuntimeError("Can't find sosreport/sysreport")
|
||||||
|
|
||||||
|
- self.__logger.log(Log.DEBUG, "report tool: %s" % exe)
|
||||||
|
+ self.__logger.log(Log.DEBUG, f"report tool: {exe}")
|
||||||
|
options = ['-k', 'rpm.rpmva=off',
|
||||||
|
'--name=rteval',
|
||||||
|
'--batch']
|
||||||
|
|
||||||
|
self.__logger.log(Log.INFO, "Generating SOS report")
|
||||||
|
- self.__logger.log(Log.INFO, "using command %s" % " ".join([exe]+options))
|
||||||
|
+ self.__logger.log(Log.INFO, f"using command {' '.join([exe]+options)}")
|
||||||
|
subprocess.call([exe] + options)
|
||||||
|
for s in glob('/tmp/s?sreport-rteval-*'):
|
||||||
|
- self.__logger.log(Log.DEBUG, "moving %s to %s" % (s, repdir))
|
||||||
|
+ self.__logger.log(Log.DEBUG, f"moving {s} to {repdir}")
|
||||||
|
shutil.move(s, repdir)
|
||||||
|
|
||||||
|
|
||||||
|
@@ -118,7 +118,7 @@ def unit_test(rootdir):
|
||||||
|
log = Log()
|
||||||
|
log.SetLogVerbosity(Log.DEBUG|Log.INFO)
|
||||||
|
osi = OSInfo(logger=log)
|
||||||
|
- print("Base OS: %s" % osi.get_base_os())
|
||||||
|
+ print(f"Base OS: {osi.get_base_os()}")
|
||||||
|
|
||||||
|
print("Testing OSInfo::copy_dmesg('/tmp'): ", end=' ')
|
||||||
|
osi.copy_dmesg('/tmp')
|
||||||
|
--
|
||||||
|
2.40.1
|
||||||
|
|
29
rteval-Use-f-strings-in-rtevalConfig.patch
Normal file
29
rteval-Use-f-strings-in-rtevalConfig.patch
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
From 2de834b44c2a731bc25449d84456396c0d519198 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Anubhav Shelat <ashelat@redhat.com>
|
||||||
|
Date: Thu, 1 Jun 2023 16:27:28 -0400
|
||||||
|
Subject: rteval: Use f-strings in rtevalConfig
|
||||||
|
|
||||||
|
Use f-strings in rtevalConfig.py
|
||||||
|
|
||||||
|
Signed-off-by: Anubhav Shelat <ashelat@redhat.com>
|
||||||
|
Signed-off-by: John Kacur <jkacur@redhat.com>
|
||||||
|
---
|
||||||
|
rteval/rtevalConfig.py | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/rteval/rtevalConfig.py b/rteval/rtevalConfig.py
|
||||||
|
index de88924642ca..41f1a567720f 100644
|
||||||
|
--- a/rteval/rtevalConfig.py
|
||||||
|
+++ b/rteval/rtevalConfig.py
|
||||||
|
@@ -115,7 +115,7 @@ class rtevalCfgSection:
|
||||||
|
"Simple method for dumping config when object is used as a string"
|
||||||
|
if not self.__cfgdata:
|
||||||
|
return "# empty"
|
||||||
|
- return "\n".join(["%s: %s" % (k, v) for k, v in list(self.__cfgdata.items())]) + "\n"
|
||||||
|
+ return "\n".join([f"{k}: {v}" for k, v in list(self.__cfgdata.items())]) + "\n"
|
||||||
|
|
||||||
|
|
||||||
|
def __setattr__(self, key, val):
|
||||||
|
--
|
||||||
|
2.40.1
|
||||||
|
|
29
rteval-Use-f-strings-in-rtevalclient.py.patch
Normal file
29
rteval-Use-f-strings-in-rtevalclient.py.patch
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
From 5e4fed8a745f70f9be1199f047069e144e9b8fd5 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Anubhav Shelat <ashelat@redhat.com>
|
||||||
|
Date: Thu, 1 Jun 2023 16:27:27 -0400
|
||||||
|
Subject: rteval: Use f-strings in rtevalclient.py
|
||||||
|
|
||||||
|
Use f-strings in rtevalclient.py
|
||||||
|
|
||||||
|
Signed-off-by: Anubhav Shelat <ashelat@redhat.com>
|
||||||
|
Signed-off-by: John Kacur <jkacur@redhat.com>
|
||||||
|
---
|
||||||
|
rteval/rtevalclient.py | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/rteval/rtevalclient.py b/rteval/rtevalclient.py
|
||||||
|
index 26c953005326..7ff7d2700cfc 100644
|
||||||
|
--- a/rteval/rtevalclient.py
|
||||||
|
+++ b/rteval/rtevalclient.py
|
||||||
|
@@ -61,7 +61,7 @@ class rtevalclient:
|
||||||
|
cmpr = compr.compress(fbuf.getvalue())
|
||||||
|
data = base64.b64encode(cmpr + compr.flush())
|
||||||
|
ret = self.srv.SendReport(self.hostname, data)
|
||||||
|
- print("rtevalclient::SendReport() - Sent %i bytes (XML document length: %i bytes, compression ratio: %.02f%%)" % (len(data), doclen, (1-(float(len(data)) / float(doclen)))*100 ))
|
||||||
|
+ print(f"rtevalclient::SendReport() - Sent {len(data)} bytes (XML document length: {doclen} bytes, compression ratio: {(1-(float(len(data)) / float(doclen)))*100}:.2f)")
|
||||||
|
return ret
|
||||||
|
|
||||||
|
def SendDataAsFile(self, fname, data, decompr = False):
|
||||||
|
--
|
||||||
|
2.40.1
|
||||||
|
|
61
rteval-Use-f-strings-in-services.py.patch
Normal file
61
rteval-Use-f-strings-in-services.py.patch
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
From d83a8eb7f0b830408659483922eca25b51bd7b5e Mon Sep 17 00:00:00 2001
|
||||||
|
From: Anubhav Shelat <ashelat@redhat.com>
|
||||||
|
Date: Thu, 1 Jun 2023 16:27:33 -0400
|
||||||
|
Subject: rteval: Use f-strings in services.py
|
||||||
|
|
||||||
|
Use f-strings in services.py
|
||||||
|
|
||||||
|
Signed-off-by: Anubhav Shelat <ashelat@redhat.com>
|
||||||
|
Signed-off-by: John Kacur <jkacur@redhat.com>
|
||||||
|
---
|
||||||
|
rteval/sysinfo/services.py | 12 ++++++------
|
||||||
|
1 file changed, 6 insertions(+), 6 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/rteval/sysinfo/services.py b/rteval/sysinfo/services.py
|
||||||
|
index c85980e19165..a87b4abeea76 100644
|
||||||
|
--- a/rteval/sysinfo/services.py
|
||||||
|
+++ b/rteval/sysinfo/services.py
|
||||||
|
@@ -55,17 +55,17 @@ class SystemServices:
|
||||||
|
break
|
||||||
|
if not servicesdir:
|
||||||
|
raise RuntimeError("No services dir (init.d) found on your system")
|
||||||
|
- self.__log(Log.DEBUG, "Services located in %s, going through each service file to check status" % servicesdir)
|
||||||
|
+ self.__log(Log.DEBUG, f"Services located in {servicesdir}, going through each service file to check status")
|
||||||
|
ret_services = {}
|
||||||
|
for service in glob.glob(os.path.join(servicesdir, '*')):
|
||||||
|
servicename = os.path.basename(service)
|
||||||
|
if not [1 for p in reject if fnmatch.fnmatch(servicename, p)] \
|
||||||
|
and os.access(service, os.X_OK):
|
||||||
|
- cmd = '%s -qs "\(^\|\W\)status)" %s' % (getcmdpath('grep'), service)
|
||||||
|
+ cmd = f'{getcmdpath("grep")} -qs "\(^\|\W\)status)" {service}'
|
||||||
|
c = subprocess.Popen(cmd, shell=True, encoding='utf-8')
|
||||||
|
c.wait()
|
||||||
|
if c.returncode == 0:
|
||||||
|
- cmd = ['env', '-i', 'LANG="%s"' % os.environ['LANG'], 'PATH="%s"' % os.environ['PATH'], 'TERM="%s"' % os.environ['TERM'], service, 'status']
|
||||||
|
+ cmd = ['env', '-i', f'LANG="{os.environ["LANG"]}"', f'PATH="{os.environ["PATH"]}"', f'TERM="{os.environ["TERM"]}"', service, 'status']
|
||||||
|
c = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, encoding='utf-8')
|
||||||
|
c.wait()
|
||||||
|
if c.returncode == 0 and (c.stdout.read() or c.stderr.read()):
|
||||||
|
@@ -79,8 +79,8 @@ class SystemServices:
|
||||||
|
|
||||||
|
def __get_services_systemd(self):
|
||||||
|
ret_services = {}
|
||||||
|
- cmd = '%s list-unit-files -t service --no-legend' % getcmdpath('systemctl')
|
||||||
|
- self.__log(Log.DEBUG, "cmd: %s" % cmd)
|
||||||
|
+ cmd = f'{getcmdpath("systemctl")} list-unit-files -t service --no-legend'
|
||||||
|
+ self.__log(Log.DEBUG, f"cmd: {cmd}")
|
||||||
|
c = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, encoding='utf-8')
|
||||||
|
for p in c.stdout:
|
||||||
|
# p are lines like b'servicename.service status'
|
||||||
|
@@ -133,7 +133,7 @@ def unit_test(rootdir):
|
||||||
|
|
||||||
|
return 0
|
||||||
|
except Exception as err:
|
||||||
|
- print("** EXCEPTION: %s" % str(err))
|
||||||
|
+ print(f"** EXCEPTION: {str(err)}")
|
||||||
|
return 1
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
2.40.1
|
||||||
|
|
27
rteval-Use-f-strings-in-tools.py.patch
Normal file
27
rteval-Use-f-strings-in-tools.py.patch
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
From adc41fa998fc15dff2c5edf3f57e6cd0970e17e5 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Anubhav Shelat <ashelat@redhat.com>
|
||||||
|
Date: Thu, 1 Jun 2023 16:27:34 -0400
|
||||||
|
Subject: rteval: Use f-strings in tools.py
|
||||||
|
|
||||||
|
Use f-strings in tools.py
|
||||||
|
|
||||||
|
Signed-off-by: Anubhav Shelat <ashelat@redhat.com>
|
||||||
|
Signed-off-by: John Kacur <jkacur@redhat.com>
|
||||||
|
---
|
||||||
|
rteval/sysinfo/tools.py | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/rteval/sysinfo/tools.py b/rteval/sysinfo/tools.py
|
||||||
|
index 3993da413d8a..aa00b3d3eafc 100644
|
||||||
|
--- a/rteval/sysinfo/tools.py
|
||||||
|
+++ b/rteval/sysinfo/tools.py
|
||||||
|
@@ -40,5 +40,5 @@ def getcmdpath(which):
|
||||||
|
pathSave[which] = cmdfile
|
||||||
|
break
|
||||||
|
if not pathSave[which]:
|
||||||
|
- raise RuntimeError("Command '%s' is unknown on this system" % which)
|
||||||
|
+ raise RuntimeError(f"Command '{which}' is unknown on this system")
|
||||||
|
return pathSave[which]
|
||||||
|
--
|
||||||
|
2.40.1
|
||||||
|
|
119
rteval-rteval-__init__.py-Convert-regular-strings-to.patch
Normal file
119
rteval-rteval-__init__.py-Convert-regular-strings-to.patch
Normal file
@ -0,0 +1,119 @@
|
|||||||
|
From 0f44bad0f6d95448425903c4ec3a3fa8093ae6e7 Mon Sep 17 00:00:00 2001
|
||||||
|
From: John Kacur <jkacur@redhat.com>
|
||||||
|
Date: Wed, 9 Nov 2022 12:28:38 -0500
|
||||||
|
Subject: rteval: rteval/__init__.py: Convert regular strings to f-strings
|
||||||
|
|
||||||
|
Convert regular strings to f-strings in __init__.py
|
||||||
|
|
||||||
|
Signed-off-by: John Kacur <jkacur@redhat.com>
|
||||||
|
---
|
||||||
|
rteval/__init__.py | 32 +++++++++++++++-----------------
|
||||||
|
1 file changed, 15 insertions(+), 17 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/rteval/__init__.py b/rteval/__init__.py
|
||||||
|
index 22af8e85d5aa..d8127425febe 100644
|
||||||
|
--- a/rteval/__init__.py
|
||||||
|
+++ b/rteval/__init__.py
|
||||||
|
@@ -59,7 +59,7 @@ def sig_handler(signum, frame):
|
||||||
|
stopsig_received = True
|
||||||
|
print("*** stop signal received - stopping rteval run ***")
|
||||||
|
else:
|
||||||
|
- raise RuntimeError("SIGNAL received! (%d)" % signum)
|
||||||
|
+ raise RuntimeError(f"SIGNAL received! ({signum})")
|
||||||
|
|
||||||
|
class RtEval(rtevalReport):
|
||||||
|
def __init__(self, config, loadmods, measuremods, logger):
|
||||||
|
@@ -96,10 +96,10 @@ class RtEval(rtevalReport):
|
||||||
|
self.__mailer = None
|
||||||
|
|
||||||
|
if not os.path.exists(self.__rtevcfg.xslt_report):
|
||||||
|
- raise RuntimeError("can't find XSL template (%s)!" % self.__rtevcfg.xslt_report)
|
||||||
|
+ raise RuntimeError(f"can't find XSL template ({self.__rtevcfg.xslt_report})!")
|
||||||
|
|
||||||
|
# Add rteval directory into module search path
|
||||||
|
- sys.path.insert(0, '%s/rteval' % sysconfig.get_python_lib())
|
||||||
|
+ sys.path.insert(0, f'{sysconfig.get_python_lib()}/rteval')
|
||||||
|
|
||||||
|
# Initialise the report module
|
||||||
|
rtevalReport.__init__(self, self.__version,
|
||||||
|
@@ -110,8 +110,7 @@ class RtEval(rtevalReport):
|
||||||
|
self.__xmlrpc = rtevalXMLRPC(self.__rtevcfg.xmlrpc, self.__logger, self.__mailer)
|
||||||
|
if not self.__xmlrpc.Ping():
|
||||||
|
if not self.__rtevcfg.xmlrpc_noabort:
|
||||||
|
- print("ERROR: Could not reach XML-RPC server '%s'. Aborting." % \
|
||||||
|
- self.__rtevcfg.xmlrpc)
|
||||||
|
+ print(f"ERROR: Could not reach XML-RPC server '{self.__rtevcfg.xmlrpc}'. Aborting.")
|
||||||
|
sys.exit(2)
|
||||||
|
else:
|
||||||
|
print("WARNING: Could not ping the XML-RPC server. Will continue anyway.")
|
||||||
|
@@ -174,8 +173,7 @@ class RtEval(rtevalReport):
|
||||||
|
|
||||||
|
measure_start = None
|
||||||
|
(with_loads, run_parallel) = measure_profile.GetProfile()
|
||||||
|
- self.__logger.log(Log.INFO, "Using measurement profile [loads: %s parallel: %s]" % (
|
||||||
|
- with_loads, run_parallel))
|
||||||
|
+ self.__logger.log(Log.INFO, f"Using measurement profile [loads: {with_loads} parallel: {run_parallel}]")
|
||||||
|
try:
|
||||||
|
nthreads = 0
|
||||||
|
|
||||||
|
@@ -183,23 +181,23 @@ class RtEval(rtevalReport):
|
||||||
|
if with_loads:
|
||||||
|
self._loadmods.Start()
|
||||||
|
|
||||||
|
- print("rteval run on %s started at %s" % (os.uname()[2], time.asctime()))
|
||||||
|
+ print(f"rteval run on {os.uname()[2]} started at {time.asctime()}")
|
||||||
|
onlinecpus = self._sysinfo.cpu_getCores(True)
|
||||||
|
cpulist = self._loadmods._cfg.GetSection("loads").cpulist
|
||||||
|
if cpulist:
|
||||||
|
- print("started %d loads on cores %s" % (self._loadmods.ModulesLoaded(), cpulist), end=' ')
|
||||||
|
+ print(f"started {self._loadmods.ModulesLoaded()} loads on cores {cpulist}", end=' ')
|
||||||
|
else:
|
||||||
|
- print("started %d loads on %d cores" % (self._loadmods.ModulesLoaded(), onlinecpus), end=' ')
|
||||||
|
+ print(f"started {self._loadmods.ModulesLoaded()} loads on {onlinecpus} cores", end=' ')
|
||||||
|
if self._sysinfo.mem_get_numa_nodes() > 1:
|
||||||
|
- print(" with %d numa nodes" % self._sysinfo.mem_get_numa_nodes())
|
||||||
|
+ print(f" with {self._sysinfo.mem_get_numa_nodes()} numa nodes")
|
||||||
|
else:
|
||||||
|
print("")
|
||||||
|
cpulist = self._measuremods._MeasurementModules__cfg.GetSection("measurement").cpulist
|
||||||
|
if cpulist:
|
||||||
|
- print("started measurement threads on cores %s" % cpulist)
|
||||||
|
+ print(f"started measurement threads on cores {cpulist}")
|
||||||
|
else:
|
||||||
|
- print("started measurement threads on %d cores" % onlinecpus)
|
||||||
|
- print("Run duration: %s seconds" % str(self.__rtevcfg.duration))
|
||||||
|
+ print(f"started measurement threads on {onlinecpus} cores")
|
||||||
|
+ print(f"Run duration: {str(self.__rtevcfg.duration)} seconds")
|
||||||
|
|
||||||
|
# start the cyclictest thread
|
||||||
|
measure_profile.Start()
|
||||||
|
@@ -219,7 +217,7 @@ class RtEval(rtevalReport):
|
||||||
|
# wait for time to expire or thread to die
|
||||||
|
signal.signal(signal.SIGINT, sig_handler)
|
||||||
|
signal.signal(signal.SIGTERM, sig_handler)
|
||||||
|
- self.__logger.log(Log.INFO, "waiting for duration (%s)" % str(self.__rtevcfg.duration))
|
||||||
|
+ self.__logger.log(Log.INFO, f"waiting for duration ({str(self.__rtevcfg.duration)})")
|
||||||
|
stoptime = (time.time() + float(self.__rtevcfg.duration))
|
||||||
|
currtime = time.time()
|
||||||
|
rpttime = currtime + report_interval
|
||||||
|
@@ -246,7 +244,7 @@ class RtEval(rtevalReport):
|
||||||
|
left_to_run = stoptime - currtime
|
||||||
|
self.__show_remaining_time(left_to_run)
|
||||||
|
rpttime = currtime + report_interval
|
||||||
|
- print("load average: %.2f" % self._loadmods.GetLoadAvg())
|
||||||
|
+ print(f"load average: {self._loadmods.GetLoadAvg():.2f}")
|
||||||
|
currtime = time.time()
|
||||||
|
|
||||||
|
self.__logger.log(Log.DEBUG, "out of measurement loop")
|
||||||
|
@@ -265,7 +263,7 @@ class RtEval(rtevalReport):
|
||||||
|
if with_loads:
|
||||||
|
self._loadmods.Stop()
|
||||||
|
|
||||||
|
- print("stopping run at %s" % time.asctime())
|
||||||
|
+ print(f"stopping run at {time.asctime()}")
|
||||||
|
|
||||||
|
# wait for measurement modules to finish calculating stats
|
||||||
|
measure_profile.WaitForCompletion()
|
||||||
|
--
|
||||||
|
2.40.1
|
||||||
|
|
64
rteval-rtevalConfig.py-Convert-regular-strings-to-f-.patch
Normal file
64
rteval-rtevalConfig.py-Convert-regular-strings-to-f-.patch
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
From 0945147e2c459dfff400fe8bfdebd11e6464eab4 Mon Sep 17 00:00:00 2001
|
||||||
|
From: John Kacur <jkacur@redhat.com>
|
||||||
|
Date: Wed, 9 Nov 2022 14:14:50 -0500
|
||||||
|
Subject: rteval: rtevalConfig.py: Convert regular strings to f-strings
|
||||||
|
|
||||||
|
Convert regular strings to f-strings in rtevalConfig.py
|
||||||
|
|
||||||
|
Signed-off-by: John Kacur <jkacur@redhat.com>
|
||||||
|
---
|
||||||
|
rteval/rtevalConfig.py | 10 +++++-----
|
||||||
|
1 file changed, 5 insertions(+), 5 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/rteval/rtevalConfig.py b/rteval/rtevalConfig.py
|
||||||
|
index decd36ed18ab..de88924642ca 100644
|
||||||
|
--- a/rteval/rtevalConfig.py
|
||||||
|
+++ b/rteval/rtevalConfig.py
|
||||||
|
@@ -196,7 +196,7 @@ class rtevalConfig:
|
||||||
|
|
||||||
|
# get our system topology info
|
||||||
|
self.__systopology = SysTopology()
|
||||||
|
- print(("got system topology: %s" % self.__systopology))
|
||||||
|
+ print(f"got system topology: {self.__systopology}")
|
||||||
|
|
||||||
|
# Import the default config first
|
||||||
|
for sect, vals in list(default_config.items()):
|
||||||
|
@@ -225,7 +225,7 @@ class rtevalConfig:
|
||||||
|
"Simple method for dumping config when object is used as a string"
|
||||||
|
ret = ""
|
||||||
|
for sect in list(self.__config_data.keys()):
|
||||||
|
- ret += "[%s]\n%s\n" % (sect, str(self.__config_data[sect]))
|
||||||
|
+ ret += f"[{sect}]\n{str(self.__config_data[sect])}\n"
|
||||||
|
return ret
|
||||||
|
|
||||||
|
|
||||||
|
@@ -240,7 +240,7 @@ class rtevalConfig:
|
||||||
|
for f in ('rteval.conf', '/etc/rteval.conf'):
|
||||||
|
p = os.path.abspath(f)
|
||||||
|
if os.path.exists(p):
|
||||||
|
- self.__info("found config file %s" % p)
|
||||||
|
+ self.__info(f"found config file {p}")
|
||||||
|
return p
|
||||||
|
raise RuntimeError("Unable to find configfile")
|
||||||
|
|
||||||
|
@@ -258,7 +258,7 @@ class rtevalConfig:
|
||||||
|
# Don't try to reread this file if it's already been parsed
|
||||||
|
return
|
||||||
|
|
||||||
|
- self.__info("reading config file %s" % cfgfile)
|
||||||
|
+ self.__info(f"reading config file {cfgfile}")
|
||||||
|
ini = configparser.ConfigParser()
|
||||||
|
ini.optionxform = str
|
||||||
|
ini.read(cfgfile)
|
||||||
|
@@ -321,7 +321,7 @@ class rtevalConfig:
|
||||||
|
# Return a new object with config settings of a given section
|
||||||
|
return self.__config_data[section]
|
||||||
|
except KeyError:
|
||||||
|
- raise KeyError("The section '%s' does not exist in the config file" % section)
|
||||||
|
+ raise KeyError(f"The section '{section}' does not exist in the config file")
|
||||||
|
|
||||||
|
|
||||||
|
def unit_test(rootdir):
|
||||||
|
--
|
||||||
|
2.40.1
|
||||||
|
|
42
rteval-rtevalReport.py-Convert-regular-strings-to-f-.patch
Normal file
42
rteval-rtevalReport.py-Convert-regular-strings-to-f-.patch
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
From 96ce02046afedfac27c69c30d6ee6b9511238131 Mon Sep 17 00:00:00 2001
|
||||||
|
From: John Kacur <jkacur@redhat.com>
|
||||||
|
Date: Wed, 9 Nov 2022 12:47:09 -0500
|
||||||
|
Subject: rteval: rtevalReport.py: Convert regular strings to f-strings
|
||||||
|
|
||||||
|
Convert regular strings to f-strings in rtevalReport.py
|
||||||
|
|
||||||
|
Signed-off-by: John Kacur <jkacur@redhat.com>
|
||||||
|
---
|
||||||
|
rteval/rtevalReport.py | 6 +++---
|
||||||
|
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/rteval/rtevalReport.py b/rteval/rtevalReport.py
|
||||||
|
index fdfaed560cfa..af3e6c9a703b 100644
|
||||||
|
--- a/rteval/rtevalReport.py
|
||||||
|
+++ b/rteval/rtevalReport.py
|
||||||
|
@@ -100,11 +100,11 @@ class rtevalReport:
|
||||||
|
|
||||||
|
def _show_report(self, xmlfile, xsltfile):
|
||||||
|
'''summarize a previously generated xml file'''
|
||||||
|
- print("Loading %s for summarizing" % xmlfile)
|
||||||
|
+ print(f"Loading {xmlfile} for summarizing")
|
||||||
|
|
||||||
|
xsltfullpath = os.path.join(self.__installdir, xsltfile)
|
||||||
|
if not os.path.exists(xsltfullpath):
|
||||||
|
- raise RuntimeError("can't find XSL template (%s)!" % xsltfullpath)
|
||||||
|
+ raise RuntimeError(f"can't find XSL template ({xsltfullpath})!")
|
||||||
|
|
||||||
|
xmlreport = xmlout.XMLOut('rteval', self.__version)
|
||||||
|
xmlreport.LoadReport(xmlfile)
|
||||||
|
@@ -131,7 +131,7 @@ class rtevalReport:
|
||||||
|
|
||||||
|
def _tar_results(self):
|
||||||
|
if not os.path.isdir(self.__reportdir):
|
||||||
|
- raise RuntimeError("no such directory: %s" % self.__reportdir)
|
||||||
|
+ raise RuntimeError(f"no such directory: {self.__reportdir}")
|
||||||
|
|
||||||
|
dirname = os.path.dirname(self.__reportdir)
|
||||||
|
rptdir = os.path.basename(self.__reportdir)
|
||||||
|
--
|
||||||
|
2.40.1
|
||||||
|
|
114
rteval-rtevalXMLRPC.py-Convert-regular-strings-to-f-.patch
Normal file
114
rteval-rtevalXMLRPC.py-Convert-regular-strings-to-f-.patch
Normal file
@ -0,0 +1,114 @@
|
|||||||
|
From eceb9de2d2a0bcf3394ca257d42f91bdcac71caf Mon Sep 17 00:00:00 2001
|
||||||
|
From: John Kacur <jkacur@redhat.com>
|
||||||
|
Date: Wed, 9 Nov 2022 13:42:59 -0500
|
||||||
|
Subject: rteval: rtevalXMLRPC.py: Convert regular strings to f-strings
|
||||||
|
|
||||||
|
Convert regular strings to f-strings in rtevalXMLRPC.py
|
||||||
|
|
||||||
|
Signed-off-by: John Kacur <jkacur@redhat.com>
|
||||||
|
---
|
||||||
|
rteval/rtevalXMLRPC.py | 34 ++++++++++++++--------------------
|
||||||
|
1 file changed, 14 insertions(+), 20 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/rteval/rtevalXMLRPC.py b/rteval/rtevalXMLRPC.py
|
||||||
|
index f24e21a8ed2f..6dce12ad78bb 100644
|
||||||
|
--- a/rteval/rtevalXMLRPC.py
|
||||||
|
+++ b/rteval/rtevalXMLRPC.py
|
||||||
|
@@ -33,7 +33,7 @@ from .Log import Log
|
||||||
|
class rtevalXMLRPC:
|
||||||
|
def __init__(self, host, logger, mailer=None):
|
||||||
|
self.__host = host
|
||||||
|
- self.__url = "http://%s/rteval/API1/" % self.__host
|
||||||
|
+ self.__url = f"http://{self.__host}/rteval/API1/"
|
||||||
|
self.__logger = logger
|
||||||
|
self.__mailer = mailer
|
||||||
|
self.__client = rtevalclient.rtevalclient(self.__url)
|
||||||
|
@@ -41,7 +41,7 @@ class rtevalXMLRPC:
|
||||||
|
|
||||||
|
def Ping(self):
|
||||||
|
res = None
|
||||||
|
- self.__logger.log(Log.DEBUG, "Checking if XML-RPC server '%s' is reachable" % self.__host)
|
||||||
|
+ self.__logger.log(Log.DEBUG, f"Checking if XML-RPC server '{self.__host}' is reachable")
|
||||||
|
attempt = 0
|
||||||
|
ping_success = False
|
||||||
|
warning_sent = False
|
||||||
|
@@ -52,10 +52,10 @@ class rtevalXMLRPC:
|
||||||
|
ping_success = True
|
||||||
|
except xmlrpc.client.ProtocolError:
|
||||||
|
# Server do not support Hello(), but is reachable
|
||||||
|
- self.__logger.log(Log.INFO, "Got XML-RPC connection with %s but it did not support Hello()" % self.__host)
|
||||||
|
+ self.__logger.log(Log.INFO, f"Got XML-RPC connection with {self.__host} but it did not support Hello()")
|
||||||
|
res = None
|
||||||
|
except socket.error as err:
|
||||||
|
- self.__logger.log(Log.INFO, "Could not establish XML-RPC contact with %s\n%s" % (self.__host, str(err)))
|
||||||
|
+ self.__logger.log(Log.INFO, f"Could not establish XML-RPC contact with {self.__host}\n{str(err)}")
|
||||||
|
|
||||||
|
# Do attempts handling
|
||||||
|
attempt += 1
|
||||||
|
@@ -63,17 +63,16 @@ class rtevalXMLRPC:
|
||||||
|
break # To avoid sleeping before we abort
|
||||||
|
|
||||||
|
if (self.__mailer is not None) and (not warning_sent):
|
||||||
|
- self.__mailer.SendMessage("[RTEVAL:WARNING] Failed to ping XML-RPC server", "Server %s did not respond." % self.__host)
|
||||||
|
+ self.__mailer.SendMessage("[RTEVAL:WARNING] Failed to ping XML-RPC server", f"Server {self.__host} did not respond.")
|
||||||
|
warning_sent = True
|
||||||
|
|
||||||
|
- print("Failed pinging XML-RPC server. Doing another attempt(%i) " % attempt)
|
||||||
|
+ print(f"Failed pinging XML-RPC server. Doing another attempt({attempt}) ")
|
||||||
|
time.sleep(attempt) #*15) # Incremental sleep - sleep attempts*15 seconds
|
||||||
|
ping_success = False
|
||||||
|
|
||||||
|
if res:
|
||||||
|
- self.__logger.log(Log.INFO, "Verified XML-RPC connection with %s (XML-RPC API version: %i)" % (res["server"], res["APIversion"]))
|
||||||
|
- self.__logger.log(Log.DEBUG, "Recieved greeting: %s" % res["greeting"])
|
||||||
|
-
|
||||||
|
+ self.__logger.log(Log.INFO, f'Verified XML-RPC connection with {res["server"]} (XML-RPC API version: {res["APIversion"]})')
|
||||||
|
+ self.__logger.log(Log.DEBUG, f"Recieved greeting: {res['greeting']}")
|
||||||
|
return ping_success
|
||||||
|
|
||||||
|
|
||||||
|
@@ -85,9 +84,9 @@ class rtevalXMLRPC:
|
||||||
|
warning_sent = False
|
||||||
|
while attempt < 6:
|
||||||
|
try:
|
||||||
|
- print("Submitting report to %s" % self.__url)
|
||||||
|
+ print(f"Submitting report to {self.__url}")
|
||||||
|
rterid = self.__client.SendReport(xmlreport)
|
||||||
|
- print("Report registered with submission id %i" % rterid)
|
||||||
|
+ print(f"Report registered with submission id {rterid}")
|
||||||
|
attempt = 10
|
||||||
|
exitcode = 0 # Success
|
||||||
|
except socket.error:
|
||||||
|
@@ -96,12 +95,10 @@ class rtevalXMLRPC:
|
||||||
|
break # To avoid sleeping before we abort
|
||||||
|
|
||||||
|
if (self.__mailer is not None) and (not warning_sent):
|
||||||
|
- self.__mailer.SendMessage("[RTEVAL:WARNING] Failed to submit report to XML-RPC server",
|
||||||
|
- "Server %s did not respond. Not giving up yet."
|
||||||
|
- % self.__host)
|
||||||
|
+ self.__mailer.SendMessage("[RTEVAL:WARNING] Failed to submit report to XML-RPC server", f"Server {self.__host} did not respond. Not giving up yet.")
|
||||||
|
warning_sent = True
|
||||||
|
|
||||||
|
- print("Failed sending report. Doing another attempt(%i) " % attempt)
|
||||||
|
+ print(f"Failed sending report. Making another attempt({attempt}) ")
|
||||||
|
time.sleep(attempt) #*5*60) # Incremental sleep - sleep attempts*5 minutes
|
||||||
|
|
||||||
|
except Exception as err:
|
||||||
|
@@ -111,12 +108,9 @@ class rtevalXMLRPC:
|
||||||
|
if self.__mailer is not None:
|
||||||
|
# Send final result messages
|
||||||
|
if exitcode == 2:
|
||||||
|
- self.__mailer.SendMessage("[RTEVAL:FAILURE] Failed to submit report to XML-RPC server",
|
||||||
|
- "Server %s did not respond at all after %i attempts."
|
||||||
|
- % (self.__host, attempt - 1))
|
||||||
|
+ self.__mailer.SendMessage("[RTEVAL:FAILURE] Failed to submit report to XML-RPC server", f"Server {self.__host} did not respond at all after {attempt - 1} attempts.")
|
||||||
|
elif (exitcode == 0) and warning_sent:
|
||||||
|
self.__mailer.SendMessage("[RTEVAL:SUCCESS] XML-RPC server available again",
|
||||||
|
- "Succeeded to submit the report to %s"
|
||||||
|
- % self.__host)
|
||||||
|
+ f"Succeeded to submit the report to {self.__host}")
|
||||||
|
|
||||||
|
return exitcode
|
||||||
|
--
|
||||||
|
2.40.1
|
||||||
|
|
64
rteval-xmlout.py-Convert-to-f-strings-where-possible.patch
Normal file
64
rteval-xmlout.py-Convert-to-f-strings-where-possible.patch
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
From ecd21eff1601e0ef666b80e0709eacbd4754250c Mon Sep 17 00:00:00 2001
|
||||||
|
From: John Kacur <jkacur@redhat.com>
|
||||||
|
Date: Tue, 6 Dec 2022 14:35:49 -0500
|
||||||
|
Subject: rteval: xmlout.py: Convert to f-strings where possible
|
||||||
|
|
||||||
|
Convert xmlout.py to f-strings where possible
|
||||||
|
|
||||||
|
Signed-off-by: John Kacur <jkacur@redhat.com>
|
||||||
|
---
|
||||||
|
rteval/xmlout.py | 10 +++++-----
|
||||||
|
1 file changed, 5 insertions(+), 5 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/rteval/xmlout.py b/rteval/xmlout.py
|
||||||
|
index a955fb11c77a..b549cc87a2cc 100644
|
||||||
|
--- a/rteval/xmlout.py
|
||||||
|
+++ b/rteval/xmlout.py
|
||||||
|
@@ -67,7 +67,7 @@ class XMLOut:
|
||||||
|
|
||||||
|
def __del__(self):
|
||||||
|
if self.level > 0:
|
||||||
|
- raise RuntimeError("XMLOut: open blocks at __del__ (last opened '%s')" % self.currtag.name)
|
||||||
|
+ raise RuntimeError(f"XMLOut: open blocks at __del__ (last opened '{self.currtag.name}')")
|
||||||
|
if self.xmldoc is not None:
|
||||||
|
self.xmldoc.freeDoc()
|
||||||
|
|
||||||
|
@@ -131,7 +131,7 @@ class XMLOut:
|
||||||
|
self.__parseToXML(n, v)
|
||||||
|
node.addChild(n)
|
||||||
|
else:
|
||||||
|
- raise TypeError("unhandled type (%s) for value '%s'" % (type(data), str(data)))
|
||||||
|
+ raise TypeError(f"unhandled type ({str(type(data))}) for value '{str(data)}'")
|
||||||
|
|
||||||
|
def close(self):
|
||||||
|
if self.status == 0:
|
||||||
|
@@ -139,7 +139,7 @@ class XMLOut:
|
||||||
|
if self.status == 3:
|
||||||
|
raise RuntimeError("XMLOut: XML document already closed")
|
||||||
|
if self.level > 0:
|
||||||
|
- raise RuntimeError("XMLOut: open blocks at close() (last opened '%s')" % self.currtag.name)
|
||||||
|
+ raise RuntimeError(f"XMLOut: open blocks at close() (last opened '{self.currtag.name}')")
|
||||||
|
|
||||||
|
if self.status == 1: # Only set the root node in the doc on created reports (NewReport called)
|
||||||
|
self.xmldoc.setRootElement(self.xmlroot)
|
||||||
|
@@ -172,7 +172,7 @@ class XMLOut:
|
||||||
|
root = self.xmldoc.children
|
||||||
|
if root.name != self.roottag:
|
||||||
|
self.status = 3
|
||||||
|
- raise RuntimeError("XMLOut: Loaded report is not a valid %s XML file" % self.roottag)
|
||||||
|
+ raise RuntimeError(f"XMLOut: Loaded report is not a valid {self.roottag} XML file")
|
||||||
|
|
||||||
|
if validate_version is True:
|
||||||
|
ver = root.hasProp('version')
|
||||||
|
@@ -183,7 +183,7 @@ class XMLOut:
|
||||||
|
|
||||||
|
if ver.getContent() != self.version:
|
||||||
|
self.status = 3
|
||||||
|
- raise RuntimeError("XMLOut: Loaded report is not of version %s" % self.version)
|
||||||
|
+ raise RuntimeError(f"XMLOut: Loaded report is not of version {self.version}")
|
||||||
|
|
||||||
|
self.status = 2 # Confirm that we have loaded a report from file
|
||||||
|
|
||||||
|
--
|
||||||
|
2.40.1
|
||||||
|
|
37
rteval.spec
37
rteval.spec
@ -1,6 +1,6 @@
|
|||||||
Name: rteval
|
Name: rteval
|
||||||
Version: 3.5
|
Version: 3.5
|
||||||
Release: 8%{?dist}
|
Release: 9%{?dist}
|
||||||
Summary: Utility to evaluate system suitability for RT Linux
|
Summary: Utility to evaluate system suitability for RT Linux
|
||||||
|
|
||||||
Group: Development/Tools
|
Group: Development/Tools
|
||||||
@ -37,6 +37,21 @@ Patch3: rteval-Don-t-attempt-to-get-DMIinfo-if-there-are-dmi.patch
|
|||||||
Patch4: rteval-Catch-failures-in-python-dmidecode.patch
|
Patch4: rteval-Catch-failures-in-python-dmidecode.patch
|
||||||
Patch5: rteval-Change-the-default-kernel-to-compile-to-linux.patch
|
Patch5: rteval-Change-the-default-kernel-to-compile-to-linux.patch
|
||||||
Patch6: Added-code-to-check-if-the-proc-net-if_inet6-file-ex.patch
|
Patch6: Added-code-to-check-if-the-proc-net-if_inet6-file-ex.patch
|
||||||
|
Patch7: rteval-rteval-__init__.py-Convert-regular-strings-to.patch
|
||||||
|
Patch8: rteval-rtevalReport.py-Convert-regular-strings-to-f-.patch
|
||||||
|
Patch9: rteval-rtevalXMLRPC.py-Convert-regular-strings-to-f-.patch
|
||||||
|
Patch10: rteval-rtevalConfig.py-Convert-regular-strings-to-f-.patch
|
||||||
|
Patch11: rteval-xmlout.py-Convert-to-f-strings-where-possible.patch
|
||||||
|
Patch12: rteval-Log.py-Convert-to-f-strings.patch
|
||||||
|
Patch13: rteval-Use-f-strings-in-rtevalclient.py.patch
|
||||||
|
Patch14: rteval-Use-f-strings-in-rtevalConfig.patch
|
||||||
|
Patch15: rteval-Use-f-strings-in-kernel.py.patch
|
||||||
|
Patch16: rteval-Use-f-strings-in-memory.py.patch
|
||||||
|
Patch17: rteval-Use-f-strings-in-osinfo.patch
|
||||||
|
Patch18: rteval-Use-f-strings-in-services.py.patch
|
||||||
|
Patch19: rteval-Use-f-strings-in-tools.py.patch
|
||||||
|
Patch20: rteval-Use-f-strings-in-cputopology.patch
|
||||||
|
|
||||||
|
|
||||||
%description
|
%description
|
||||||
The rteval script is a utility for measuring various aspects of
|
The rteval script is a utility for measuring various aspects of
|
||||||
@ -55,6 +70,20 @@ to the screen.
|
|||||||
%patch4 -p1
|
%patch4 -p1
|
||||||
%patch5 -p1
|
%patch5 -p1
|
||||||
%patch6 -p1
|
%patch6 -p1
|
||||||
|
%patch7 -p1
|
||||||
|
%patch8 -p1
|
||||||
|
%patch9 -p1
|
||||||
|
%patch10 -p1
|
||||||
|
%patch11 -p1
|
||||||
|
%patch12 -p1
|
||||||
|
%patch13 -p1
|
||||||
|
%patch14 -p1
|
||||||
|
%patch15 -p1
|
||||||
|
%patch16 -p1
|
||||||
|
%patch17 -p1
|
||||||
|
%patch18 -p1
|
||||||
|
%patch19 -p1
|
||||||
|
%patch20 -p1
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%{__python3} setup.py build
|
%{__python3} setup.py build
|
||||||
@ -76,7 +105,11 @@ to the screen.
|
|||||||
%{_bindir}/rteval
|
%{_bindir}/rteval
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
* Mon Jun 06 2023 Anubhav Shelat <ashelat@redhat.com> - 3.5-8
|
* Fri Aug 11 2023 John Kacur <jkacur@redhat.com> - 3.5-9
|
||||||
|
- Added patches to use f-strings where possible, no functional change
|
||||||
|
jiraProject== RHEL-798
|
||||||
|
|
||||||
|
* Mon Jun 05 2023 Anubhav Shelat <ashelat@redhat.com> - 3.5-8
|
||||||
- Added code to check if the proc/net/if_inet6 file exists while
|
- Added code to check if the proc/net/if_inet6 file exists while
|
||||||
loading IPv6 addresses in the IPv6Addresses class.
|
loading IPv6 addresses in the IPv6Addresses class.
|
||||||
Resolves: rhbz#2210103
|
Resolves: rhbz#2210103
|
||||||
|
Loading…
Reference in New Issue
Block a user