Force configure input files to be utf-8. Closes #927.

pull/918/head
Jussi Pakkanen 8 years ago
parent f7a60099f6
commit 5f20b38d44
  1. 6
      mesonbuild/mesonlib.py

@ -273,10 +273,10 @@ def do_mesondefine(line, confdata):
def do_conf_file(src, dst, confdata): def do_conf_file(src, dst, confdata):
try: try:
with open(src) as f: with open(src, encoding='utf-8') as f:
data = f.readlines() data = f.readlines()
except Exception: except Exception as e:
raise MesonException('Could not read input file %s.' % src) raise MesonException('Could not read input file %s: %s' % (src, str(e)))
# Only allow (a-z, A-Z, 0-9, _, -) as valid characters for a define # Only allow (a-z, A-Z, 0-9, _, -) as valid characters for a define
# Also allow escaping '@' with '\@' # Also allow escaping '@' with '\@'
regex = re.compile(r'[^\\]?@([-a-zA-Z0-9_]+)@') regex = re.compile(r'[^\\]?@([-a-zA-Z0-9_]+)@')

Loading…
Cancel
Save