aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2018-01-04 13:48:29 -0500
committerDavid Robillard <d@drobilla.net>2018-01-04 19:34:53 -0500
commit982e8327a07c5da2eda2798ac184779bf3f8d2c7 (patch)
treea93d4691a8096d3a283d5bababbe42819faff3a0
parent3115d8702b9f7a4bfc07af2a95fe3a4893811697 (diff)
downloadserd-982e8327a07c5da2eda2798ac184779bf3f8d2c7.tar.gz
serd-982e8327a07c5da2eda2798ac184779bf3f8d2c7.tar.bz2
serd-982e8327a07c5da2eda2798ac184779bf3f8d2c7.zip
Specify encoding when comparing files in Python
-rw-r--r--wscript8
1 files changed, 4 insertions, 4 deletions
diff --git a/wscript b/wscript
index 149f8701..ea6b7c51 100644
--- a/wscript
+++ b/wscript
@@ -214,8 +214,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') as fa:
- with open(pathb, 'rU') as fb:
+ with open(patha, 'rU', encoding='utf-8') as fa:
+ with open(pathb, 'rU', encoding='utf-8') as fb:
for linea in fa:
lineb = fb.readline()
if (linea.replace(subst_from, subst_to) !=
@@ -257,8 +257,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) as out_file:
- with open(check_filename) as check_file:
+ with open(out_filename, encoding='utf-8') as out_file:
+ with open(check_filename, encoding='utf-8') as check_file:
diff = difflib.unified_diff(check_file.readlines(),
out_file.readlines(),
fromfile=check_filename,