Always use UTF-8 to open files in list_sources.py.

This avoids problems with some locale settings.

Signed-off-by: Eduardo Sánchez Muñoz <eduardosanchezmunoz@gmail.com> (github: eduardosm)
This commit is contained in:
Eduardo Sánchez Muñoz 2017-06-26 12:52:50 +02:00 committed by John Preston
parent 8b54910538
commit 2eff766e88

View File

@ -23,6 +23,7 @@ import sys
import os
import re
import time
import codecs
def eprint(*args, **kwargs):
print(*args, file=sys.stderr, **kwargs)
@ -32,7 +33,7 @@ def check_non_empty_moc(file_path):
if not os.path.isfile(file_path):
return False
if re.search(r'\.h$', file_path):
with open(file_path, "r") as f:
with codecs.open(file_path, mode="r", encoding="utf-8") as f:
for line in f:
if re.search(r'(^|\s)Q_OBJECT(\s|$)', line):
return True