Open Meson and option files explicitly as utf-8. Closes #467.

pull/478/head
Jussi Pakkanen 9 years ago
parent 4bb665a577
commit 8b619420f9
  1. 4
      mesonbuild/interpreter.py
  2. 2
      mesonbuild/optinterpreter.py

@ -925,7 +925,7 @@ class Interpreter():
mesonfile = os.path.join(self.source_root, self.subdir, environment.build_filename)
if not os.path.isfile(mesonfile):
raise InvalidArguments('Missing Meson file in %s' % mesonfile)
code = open(mesonfile).read()
code = open(mesonfile, encoding='utf8').read()
if len(code.strip()) == 0:
raise InvalidCode('Builder file is empty.')
assert(isinstance(code, str))
@ -1783,7 +1783,7 @@ class Interpreter():
absname = os.path.join(self.environment.get_source_dir(), buildfilename)
if not os.path.isfile(absname):
raise InterpreterException('Nonexistant build def file %s.' % buildfilename)
code = open(absname).read()
code = open(absname, encoding='utf8').read()
assert(isinstance(code, str))
try:
codeblock = mparser.Parser(code).parse()

@ -73,7 +73,7 @@ class OptionInterpreter:
def process(self, option_file):
try:
ast = mparser.Parser(open(option_file, 'r').read()).parse()
ast = mparser.Parser(open(option_file, 'r', encoding='utf8').read()).parse()
except coredata.MesonException as me:
me.file = option_file
raise me

Loading…
Cancel
Save