diff --git i/SConstruct w/SConstruct index 4358a23..7f3cc94 100644 --- i/SConstruct +++ w/SConstruct @@ -20,6 +20,8 @@ # ==================================================================== # +from __future__ import print_function + import sys import os import re @@ -163,9 +165,9 @@ env.Append(BUILDERS = { 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 @@ CALLOUT_OKAY = not (env.GetOption('clean') or env.GetOption('help')) 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']) diff --git i/build/check.py w/build/check.py index 2dacb4c..76945af 100755 --- i/build/check.py +++ w/build/check.py @@ -22,6 +22,8 @@ # =================================================================== # +from __future__ import print_function + import sys import glob import subprocess @@ -52,16 +54,16 @@ if __name__ == '__main__': # 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) diff --git i/build/gen_def.py w/build/gen_def.py index a2222d0..1e006ee 100755 --- i/build/gen_def.py +++ w/build/gen_def.py @@ -52,12 +52,13 @@ _types = re.compile(r'^extern const serf_bucket_type_t (serf_[a-z_]*);', 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