serf: build with scons-python3

This commit is contained in:
Đoàn Trần Công Danh 2020-10-20 00:18:09 +07:00
parent 510795353c
commit df444b7ea0
3 changed files with 105 additions and 0 deletions

View File

@ -0,0 +1,31 @@
From 5a73b7ce7350f19fd5f908803be104b1ded97366 Mon Sep 17 00:00:00 2001
From: Andreas Stieger <astieger@apache.org>
Date: Wed, 8 Nov 2017 17:05:28 +0000
Subject: [PATCH 1/3] Follow-up to r1811083, fix building with scons 3.0.0 and
Python3
* SConstruct: Append decode('utf-8) to FILE.get_contents() to avoid
TypeError: cannot use a string pattern on a bytes-like object
git-svn-id: https://svn.apache.org/repos/asf/serf/trunk@1814604 13f79535-47bb-0310-9956-ffa450edef68
---
SConstruct | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git SConstruct SConstruct
index 4358a23..1766870 100644
--- SConstruct
+++ SConstruct
@@ -166,7 +166,7 @@ env.Append(BUILDERS = {
match = re.search('SERF_MAJOR_VERSION ([0-9]+).*'
'SERF_MINOR_VERSION ([0-9]+).*'
'SERF_PATCH_VERSION ([0-9]+)',
- env.File('serf.h').get_contents(),
+ env.File('serf.h').get_contents().decode('utf-8'),
re.DOTALL)
MAJOR, MINOR, PATCH = [int(x) for x in match.groups()]
env.Append(MAJOR=str(MAJOR))
--
2.29.0.rc1

View File

@ -0,0 +1,31 @@
From 212b70149bc943de7180aa8c18e1f92e1cd76ec7 Mon Sep 17 00:00:00 2001
From: Bert Huijben <rhuijben@apache.org>
Date: Wed, 4 Oct 2017 14:56:22 +0000
Subject: [PATCH 2/3] Fix syntax of a print() in the scons file to unbreak
building with most recent scons version.
* SConstruct
Use Python 3.0 valid syntax to make Scons 3.0.0 happy on both python 3.0
and 2.7.
git-svn-id: https://svn.apache.org/repos/asf/serf/trunk@1811083 13f79535-47bb-0310-9956-ffa450edef68
---
SConstruct | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git SConstruct SConstruct
index 1766870..a7e18da 100644
--- SConstruct
+++ SConstruct
@@ -183,7 +183,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'])
--
2.29.0.rc1

View File

@ -0,0 +1,43 @@
From a00f7abd15a92ae77806edca6227ed09aae2b711 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Branko=20=C4=8Cibej?= <brane@apache.org>
Date: Sat, 9 Jun 2018 08:10:10 +0000
Subject: [PATCH 3/3] Make the tests run with Python 3.x.
* build/check.py: Add parentheses around 'print' statement arguments
so that they work when 'print' is a function.
git-svn-id: https://svn.apache.org/repos/asf/serf/trunk@1833223 13f79535-47bb-0310-9956-ffa450edef68
---
build/check.py | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git build/check.py build/check.py
index 2dacb4c..341bb3b 100755
--- build/check.py
+++ build/check.py
@@ -52,16 +52,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)
+ except subprocess.CalledProcessError as x:
+ print("ERROR: test failed in '%s', exit code=%d" % (x.cmd, x.returncode))
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"
+ except subprocess.CalledProcessError as x:
+ print("ERROR: test(s) failed in '%s', exit code=%d" % (x.cmd, x.returncode))
sys.exit(1)
--
2.29.0.rc1