Open build files with utf-8

pull/3421/head
Nirbheek Chauhan 7 years ago committed by Nirbheek Chauhan
parent 695b8f3a03
commit 6089631a1b
  1. 6
      mesonbuild/backend/ninjabackend.py
  2. 6
      mesonbuild/backend/vs2010backend.py

@ -169,7 +169,7 @@ class NinjaBackend(backends.Backend):
break
else:
# None of our compilers are MSVC, we're done.
return open(tempfilename, 'a')
return open(tempfilename, 'a', encoding='utf-8')
filename = os.path.join(self.environment.get_scratch_dir(),
'incdetect.c')
with open(filename, 'w') as f:
@ -196,7 +196,7 @@ int dummy;
if match:
with open(tempfilename, 'ab') as binfile:
binfile.write(b'msvc_deps_prefix = ' + match.group(1) + b'\n')
return open(tempfilename, 'a')
return open(tempfilename, 'a', encoding='utf-8')
raise MesonException('Could not determine vs dep dependency prefix string.')
def generate(self, interp):
@ -206,7 +206,7 @@ int dummy;
raise MesonException('Could not detect Ninja v1.5 or newer')
outfilename = os.path.join(self.environment.get_build_dir(), self.ninja_filename)
tempfilename = outfilename + '~'
with open(tempfilename, 'w') as outfile:
with open(tempfilename, 'w', encoding='utf-8') as outfile:
outfile.write('# This is the build file for project "%s"\n' %
self.build.get_project())
outfile.write('# It is autogenerated by the Meson build system.\n')

@ -227,7 +227,7 @@ class Vs2010Backend(backends.Backend):
def generate_solution(self, sln_filename, projlist):
default_projlist = self.get_build_by_default_targets()
with open(sln_filename, 'w') as ofile:
with open(sln_filename, 'w', encoding='utf-8') as ofile:
ofile.write('Microsoft Visual Studio Solution File, Format '
'Version 11.00\n')
ofile.write('# Visual Studio ' + self.vs_version + '\n')
@ -575,7 +575,7 @@ class Vs2010Backend(backends.Backend):
tree.write(ofname, encoding='utf-8', xml_declaration=True)
# ElementTree can not do prettyprinting so do it manually
doc = xml.dom.minidom.parse(ofname)
with open(ofname, 'w') as of:
with open(ofname, 'w', encoding='utf-8') as of:
of.write(doc.toprettyxml())
def gen_vcxproj(self, target, ofname, guid):
@ -1119,7 +1119,7 @@ if %%errorlevel%% neq 0 goto :VCEnd'''
igroup = ET.SubElement(root, 'ItemGroup')
rulefile = os.path.join(self.environment.get_scratch_dir(), 'regen.rule')
if not os.path.exists(rulefile):
with open(rulefile, 'w') as f:
with open(rulefile, 'w', encoding='utf-8') as f:
f.write("# Meson regen file.")
custombuild = ET.SubElement(igroup, 'CustomBuild', Include=rulefile)
message = ET.SubElement(custombuild, 'Message')

Loading…
Cancel
Save