aboutsummaryrefslogtreecommitdiffstats
path: root/wscript
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2018-01-16 22:10:54 +0100
committerDavid Robillard <d@drobilla.net>2018-01-16 22:10:54 +0100
commit0d886733b5fafceb8c3b954dbb31c57ed7583d9a (patch)
tree37b3940eaec85b8c6ee27b9d433eb2ca25c44f37 /wscript
parent4cf79685ffb3a0d75e901412f4125590d61959a4 (diff)
downloadserd-0d886733b5fafceb8c3b954dbb31c57ed7583d9a.tar.gz
serd-0d886733b5fafceb8c3b954dbb31c57ed7583d9a.tar.bz2
serd-0d886733b5fafceb8c3b954dbb31c57ed7583d9a.zip
Fix test suite with Python 2
Diffstat (limited to 'wscript')
-rw-r--r--wscript9
1 files changed, 5 insertions, 4 deletions
diff --git a/wscript b/wscript
index 2ef49161..1ab56bda 100644
--- a/wscript
+++ b/wscript
@@ -1,5 +1,6 @@
#!/usr/bin/env python
import glob
+import io
import os
import waflib.Logs as Logs
import waflib.Options as Options
@@ -214,8 +215,8 @@ def upload_docs(ctx):
os.system('rsync -avz --delete -e ssh build/%s.html drobilla@drobilla.net:~/drobilla.net/man/' % page)
def file_equals(patha, pathb, subst_from='', subst_to=''):
- with open(patha, 'rU', encoding='utf-8') as fa:
- with open(pathb, 'rU', encoding='utf-8') as fb:
+ with io.open(patha, 'rU', encoding='utf-8') as fa:
+ with io.open(pathb, 'rU', encoding='utf-8') as fb:
for linea in fa:
lineb = fb.readline()
if (linea.replace(subst_from, subst_to) !=
@@ -257,8 +258,8 @@ def check_output(out_filename, check_filename, subst_from='', subst_to=''):
elif not file_equals(check_filename, out_filename, subst_from, subst_to):
Logs.pprint('RED', 'FAIL: %s != %s' % (os.path.abspath(out_filename),
check_filename))
- with open(out_filename, encoding='utf-8') as out_file:
- with open(check_filename, encoding='utf-8') as check_file:
+ with io.open(out_filename, encoding='utf-8') as out_file:
+ with io.open(check_filename, encoding='utf-8') as check_file:
diff = difflib.unified_diff(check_file.readlines(),
out_file.readlines(),
fromfile=check_filename,