--- a/SConstruct 2023-06-16 22:40:32.223358545 +0300 +++ b/SConstruct 2023-06-16 22:45:42.583351356 +0300 @@ -20,6 +20,8 @@ # ==================================================================== # +from __future__ import print_function + import sys import os import re @@ -163,9 +165,9 @@ suffix='.def', src_suffix='.h') }) -match = re.search('SERF_MAJOR_VERSION ([0-9]+).*' - 'SERF_MINOR_VERSION ([0-9]+).*' - 'SERF_PATCH_VERSION ([0-9]+)', +match = re.search(b'SERF_MAJOR_VERSION ([0-9]+).*' + b'SERF_MINOR_VERSION ([0-9]+).*' + b'SERF_PATCH_VERSION ([0-9]+)', env.File('serf.h').get_contents(), re.DOTALL) MAJOR, MINOR, PATCH = [int(x) for x in match.groups()] @@ -183,7 +185,7 @@ unknown = opts.UnknownVariables() if unknown: - print 'Warning: Used unknown variables:', ', '.join(unknown.keys()) + print( 'Warning: Used unknown variables:', ', '.join(unknown.keys())) apr = str(env['APR']) apu = str(env['APU']) --- a/build/check.py 2023-06-16 22:46:12.155350671 +0300 +++ b/build/check.py 2023-06-16 22:47:50.051348403 +0300 @@ -22,6 +22,8 @@ # =================================================================== # +from __future__ import print_function + import sys import glob import subprocess @@ -52,16 +54,16 @@ # Find test responses and run them one by one for case in glob.glob(testdir + "/testcases/*.response"): - print "== Testing %s ==" % (case) + print( "== Testing %s ==" % (case)) try: subprocess.check_call([SERF_RESPONSE_EXE, case]) except subprocess.CalledProcessError: - print "ERROR: test case %s failed" % (case) + print( "ERROR: test case %s failed" % (case)) sys.exit(1) - print "== Running the unit tests ==" + print( "== Running the unit tests ==") try: subprocess.check_call(TEST_ALL_EXE) except subprocess.CalledProcessError: - print "ERROR: test(s) failed in test_all" + print( "ERROR: test(s) failed in test_all") sys.exit(1) --- a/build/gen_def.py 2023-06-16 22:48:02.127348123 +0300 +++ b/build/gen_def.py 2023-06-16 22:50:38.447344503 +0300 @@ -52,12 +52,13 @@ def extract_exports(fname): - content = open(fname).read() exports = [ ] - for name in _funcs.findall(content): - exports.append(name) - for name in _types.findall(content): - exports.append(name) + with open(fname) as fd: + content = fd.read() + for name in _funcs.findall(content): + exports.append(name) + for name in _types.findall(content): + exports.append(name) return exports # Blacklist the serf v2 API for now