Skip to content

Commit 6b29931

Browse files
committed
Fix Python syntax warnings and import issues
- Add missing tempfile import in verify_submission.py - Fix invalid escape sequence in error message string - Resolve syntax warnings for Python 3.12+ compatibility - Fix regex pattern using raw strings
1 parent 8e209d2 commit 6b29931

File tree

4 files changed

+45
-44
lines changed

4 files changed

+45
-44
lines changed

common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ def sanitizePackageLog(log, report = None):
303303
slog = log.decode('utf-8', 'ignore')
304304
slog = slog.replace('\r\n', '\n')
305305
slog = slog.replace('\t', ' ')
306-
slog = re.sub(' \(.*(tag: .*)+\)', '', slog)
306+
slog = re.sub(r' \(.*(tag: .*)+\)', '', slog)
307307
slog = slog.rstrip('\n')
308308
return slog
309309

package.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def getPackageDescription (report, verification):
105105
if reobj.match(log) == None:
106106
report.failure("Test log name does not conform to --deqp-fraction option", log)
107107
for log in testLogs:
108-
prefix = re.split("(\d+-of-\d+)+", log)[0]
108+
prefix = re.split(r"(\d+-of-\d+)+", log)[0]
109109
if prefix in testLogsFraction:
110110
fractionLogs = testLogsFraction[prefix]
111111
else:

utils.py

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -40,49 +40,49 @@
4040
StatusCode.WAIVER
4141
])
4242

43-
SUPPORTED_RELEASES = ['vulkan-cts-[0-9]\.[0-9]\.[0-9]*\.[0-9]*',
44-
'vulkansc-cts-1\.0\.[0-9]*\.[0-9]*',
45-
'opengl-cts-4\.6\.[0-9]*\.[0-9]*',
46-
'opengl-es-cts-3\.2\.([2-9]|[1-9][0-9]+)\.[0-9]*']
47-
WITHDRAWN_RELEASES = ['vulkan-cts-1\.0\.0\.[0-9]*',
48-
'vulkan-cts-1\.0\.1\.[0-9]*',
49-
'vulkan-cts-1\.0\.2\.[0-9]*',
50-
'vulkan-cts-1\.1\.0\.[0-9]*',
51-
'vulkan-cts-1\.1\.1\.[0-9]*',
52-
'vulkan-cts-1\.1\.2\.[0-9]*',
53-
'vulkan-cts-1\.1\.3\.[0-9]*',
54-
'vulkan-cts-1\.1\.4\.[0-9]*',
55-
'vulkan-cts-1\.1\.5\.[0-9]*',
56-
'vulkan-cts-1\.1\.6\.[0-9]*',
57-
'vulkan-cts-1\.2\.0\.[0-9]*',
58-
'vulkan-cts-1\.2\.1\.[0-9]*',
59-
'vulkan-cts-1\.2\.2\.[0-9]*',
60-
'vulkan-cts-1\.2\.3\.[0-9]*',
61-
'vulkan-cts-1\.2\.4\.[0-9]*',
62-
'vulkan-cts-1\.2\.5\.[0-9]*',
63-
'vulkan-cts-1\.2\.6\.[0-9]*',
64-
'vulkan-cts-1\.2\.7\.[0-9]*',
65-
'vulkan-cts-1\.2\.8\.[0-9]*',
66-
'vulkan-cts-1\.3\.0\.[0-9]*',
67-
'vulkan-cts-1\.3\.1\.[0-9]*',
68-
'vulkan-cts-1\.3\.2\.[0-9]*',
69-
'vulkan-cts-1\.3\.3\.[0-9]*',
70-
'vulkan-cts-1\.3\.4\.[0-9]*',
71-
'vulkan-cts-1\.3\.5\.[0-9]*',
72-
'vulkan-cts-1\.3\.6\.[0-9]*',
73-
'vulkan-cts-1\.3\.7\.[0-9]*',
74-
'vulkansc-cts-1\.0\.0\.[0-9]*',
75-
'vulkansc-cts-1\.0\.1\.[0-9]*']
76-
NOT_MASTER_DIR = ['vulkan-cts-1\.0\.[0-9]*\.[0-9]*',
77-
'vulkan-cts-1\.1\.0\.[0-9]*',
78-
'vulkan-cts-1\.1\.1\.[0-9]*',
79-
'vulkan-cts-1\.1\.2\.[0-9]*',
80-
'vulkan-cts-1\.1\.3\.[0-9]*',
81-
'vulkan-cts-1\.1\.4\.[0-9]*']
43+
SUPPORTED_RELEASES = [r'vulkan-cts-[0-9]\.[0-9]\.[0-9]*\.[0-9]*',
44+
r'vulkansc-cts-1\.0\.[0-9]*\.[0-9]*',
45+
r'opengl-cts-4\.6\.[0-9]*\.[0-9]*',
46+
r'opengl-es-cts-3\.2\.([2-9]|[1-9][0-9]+)\.[0-9]*']
47+
WITHDRAWN_RELEASES = [r'vulkan-cts-1\.0\.0\.[0-9]*',
48+
r'vulkan-cts-1\.0\.1\.[0-9]*',
49+
r'vulkan-cts-1\.0\.2\.[0-9]*',
50+
r'vulkan-cts-1\.1\.0\.[0-9]*',
51+
r'vulkan-cts-1\.1\.1\.[0-9]*',
52+
r'vulkan-cts-1\.1\.2\.[0-9]*',
53+
r'vulkan-cts-1\.1\.3\.[0-9]*',
54+
r'vulkan-cts-1\.1\.4\.[0-9]*',
55+
r'vulkan-cts-1\.1\.5\.[0-9]*',
56+
r'vulkan-cts-1\.1\.6\.[0-9]*',
57+
r'vulkan-cts-1\.2\.0\.[0-9]*',
58+
r'vulkan-cts-1\.2\.1\.[0-9]*',
59+
r'vulkan-cts-1\.2\.2\.[0-9]*',
60+
r'vulkan-cts-1\.2\.3\.[0-9]*',
61+
r'vulkan-cts-1\.2\.4\.[0-9]*',
62+
r'vulkan-cts-1\.2\.5\.[0-9]*',
63+
r'vulkan-cts-1\.2\.6\.[0-9]*',
64+
r'vulkan-cts-1\.2\.7\.[0-9]*',
65+
r'vulkan-cts-1\.2\.8\.[0-9]*',
66+
r'vulkan-cts-1\.3\.0\.[0-9]*',
67+
r'vulkan-cts-1\.3\.1\.[0-9]*',
68+
r'vulkan-cts-1\.3\.2\.[0-9]*',
69+
r'vulkan-cts-1\.3\.3\.[0-9]*',
70+
r'vulkan-cts-1\.3\.4\.[0-9]*',
71+
r'vulkan-cts-1\.3\.5\.[0-9]*',
72+
r'vulkan-cts-1\.3\.6\.[0-9]*',
73+
r'vulkan-cts-1\.3\.7\.[0-9]*',
74+
r'vulkansc-cts-1\.0\.0\.[0-9]*',
75+
r'vulkansc-cts-1\.0\.1\.[0-9]*']
76+
NOT_MASTER_DIR = [r'vulkan-cts-1\.0\.[0-9]*\.[0-9]*',
77+
r'vulkan-cts-1\.1\.0\.[0-9]*',
78+
r'vulkan-cts-1\.1\.1\.[0-9]*',
79+
r'vulkan-cts-1\.1\.2\.[0-9]*',
80+
r'vulkan-cts-1\.1\.3\.[0-9]*',
81+
r'vulkan-cts-1\.1\.4\.[0-9]*']
8282
API_TYPE_DICT = {'VK' : 'Vulkan', 'VKSC' : 'Vulkan SC', 'GL' : 'OpenGL', 'ES' : 'OpenGL ES'}
83-
API_VERSION_REGEX = ".*\-cts\-([0-9]+)\.([0-9]+)\..+"
83+
API_VERSION_REGEX = r".*\-cts\-([0-9]+)\.([0-9]+)\..+"
8484
RELEASE_TAG_DICT = {'VK' : 'vulkan-cts', 'VKSC' : 'vulkansc-cts', 'ES' : 'opengl-es-cts', 'GL' : 'opengl-cts'}
85-
KC_CTS_RELEASE = ["opengl-es-cts-3\.2\.[2-3]\.[0-9]*", "opengl-cts-4\.6\.[0-5]*\.[0-9]*"]
85+
KC_CTS_RELEASE = [r"opengl-es-cts-3\.2\.[2-3]\.[0-9]*", r"opengl-cts-4\.6\.[0-5]*\.[0-9]*"]
8686

8787
class Mustpass:
8888
def __init__(self, filename):

verify_submission.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import re
2626
import sys
2727
import argparse
28+
import tempfile
2829

2930
from package import *
3031
from report import *
@@ -102,7 +103,7 @@ def parseArgs ():
102103
apiType = "Invalid"
103104

104105
if apiType not in API_TYPE_DICT:
105-
report.failure("Incorrect package name: %s. The file should be named as \<API\>\<API version\>_\<Adopter\>_\<Info\>.tgz. See the README for more info." % packageFileBN)
106+
report.failure("Incorrect package name: %s. The file should be named as <API><API version>_<Adopter>_<Info>.tgz. See the README for more info." % packageFileBN)
106107
else:
107108
apiName = API_TYPE_DICT[apiType] + ' ' + apiVersion
108109

0 commit comments

Comments
 (0)