1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
|
From b2b7b49ffbf5d5ef135635d28eb6488f415f9879 Mon Sep 17 00:00:00 2001
From: fly_fzc <2385803914@qq.com>
Date: Tue, 11 Mar 2025 15:23:29 +0800
Subject: [PATCH] Fix print Syntax error
---
src/pki/testdata/ocsp_unittest/annotate_test_data.py | 6 +-
.../parse_certificate_unittest/regenerate_pem_from_ascii.py | 10 +-
.../testdata/verify_signed_data_unittest/annotate_test_data.py | 4 +-
src/util/generate-asm-lcov.py | 4 +-
4 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/src/pki/testdata/ocsp_unittest/annotate_test_data.py b/src/pki/testdata/ocsp_unittest/annotate_test_data.py
index 8e9262b..dbcaf27 100755
--- a/src/pki/testdata/ocsp_unittest/annotate_test_data.py
+++ b/src/pki/testdata/ocsp_unittest/annotate_test_data.py
@@ -85,7 +85,7 @@ def GenerateCommentForBlock(block_name, block_data):
stdout_data = stdout_data.replace("-----", "~~~~~")
return '$ openssl ocsp -resp_text -respin <([%s])\n%s' % (block_name,
stdout_data)
- print 'Error pretty printing OCSP response:\n',stderr_data
+ print ('Error pretty printing OCSP response:\n',stderr_data)
# Otherwise try pretty printing using asn1parse.
@@ -205,12 +205,12 @@ def WriteStringToFile(data, path):
def main():
for path in GetPemFilePaths():
- print "Processing %s ..." % (path)
+ print ("Processing %s ..." % (path))
original_data = ReadFileToString(path)
transformed_data = Transform(original_data)
if original_data != transformed_data:
WriteStringToFile(transformed_data, path)
- print "Rewrote %s" % (path)
+ print ("Rewrote %s" % (path))
if __name__ == "__main__":
diff --git a/src/pki/testdata/parse_certificate_unittest/regenerate_pem_from_ascii.py b/src/pki/testdata/parse_certificate_unittest/regenerate_pem_from_ascii.py
index 38316fb..798535a 100755
--- a/src/pki/testdata/parse_certificate_unittest/regenerate_pem_from_ascii.py
+++ b/src/pki/testdata/parse_certificate_unittest/regenerate_pem_from_ascii.py
@@ -31,7 +31,7 @@ def read_file_to_string(path):
def write_string_to_file(data, path):
"""Writes a string to a file"""
- print "Writing file %s ..." % (path)
+ print ("Writing file %s ..." % (path))
with open(path, "w") as f:
f.write(data)
@@ -48,7 +48,7 @@ def apply_substitution(template, name, value):
(re.escape(name), re.escape(name)), re.DOTALL)
m = regex.search(template)
if not m:
- print "Couldn't find a section named %s in the template" % (name)
+ print ("Couldn't find a section named %s in the template" % (name))
sys.exit(1)
return replace_string(template, m.start(1), m.end(1), value)
@@ -56,7 +56,7 @@ def apply_substitution(template, name, value):
def main():
if len(sys.argv) != 2:
- print 'Usage: %s <PATH_TO_PEM>' % (sys.argv[0])
+ print ('Usage: %s <PATH_TO_PEM>' % (sys.argv[0]))
sys.exit(1)
pem_path = sys.argv[1]
@@ -73,7 +73,7 @@ def main():
cert_ascii = apply_substitution(cert_ascii, m.group(1), m.group(2))
if num_matches == 0:
- print "Input did not contain any substitutions"
+ print ("Input did not contain any substitutions")
sys.exit(1)
# Convert the ascii-der to actual DER binary.
@@ -93,7 +93,7 @@ def main():
'-----END CERTIFICATE-----', re.DOTALL)
m = regex.search(orig)
if not m:
- print "ERROR: Cannot find CERTIFICATE block in input"
+ print ("ERROR: Cannot find CERTIFICATE block in input")
sys.exit(1)
modified = replace_string(orig, m.start(1), m.end(1),
base64.b64encode(cert_der))
diff --git a/src/pki/testdata/verify_signed_data_unittest/annotate_test_data.py b/src/pki/testdata/verify_signed_data_unittest/annotate_test_data.py
index 9e6b478..5462d25 100755
--- a/src/pki/testdata/verify_signed_data_unittest/annotate_test_data.py
+++ b/src/pki/testdata/verify_signed_data_unittest/annotate_test_data.py
@@ -152,7 +152,7 @@ def WriteStringToFile(data, path):
def main():
for path in GetPemFilePaths():
- print "Processing %s ..." % (path)
+ print ("Processing %s ..." % (path))
original_data = ReadFileToString(path)
transformed_data = Transform(original_data)
if original_data != transformed_data:
@@ -157,7 +157,7 @@ def main():
transformed_data = Transform(original_data)
if original_data != transformed_data:
WriteStringToFile(transformed_data, path)
- print "Rewrote %s" % (path)
+ print ("Rewrote %s" % (path))
if __name__ == "__main__":
diff --git a/src/util/generate-asm-lcov.py b/src/util/generate-asm-lcov.py
index 257ae84..06df336 100755
--- a/src/util/generate-asm-lcov.py
+++ b/src/util/generate-asm-lcov.py
@@ -128,7 +128,7 @@ def output(data):
if __name__ == '__main__':
if len(sys.argv) != 3:
- print '%s <Callgrind Folder> <Build Folder>' % (__file__)
+ print ('%s <Callgrind Folder> <Build Folder>' % (__file__))
sys.exit()
cg_folder = sys.argv[1]
@@ -149,4 +149,4 @@ if __name__ == '__main__':
annotated = merge(cg_files, srcs)
lcov = generate(annotated)
- print output(lcov)
+ print (output(lcov))
--
2.33.0
|