133 lines
5.1 KiB
Diff
133 lines
5.1 KiB
Diff
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
|