Make vs dependency detector work on non-english locales.
This commit is contained in:
parent
015688f506
commit
c86ee8158a
|
@ -22,7 +22,7 @@ from meson_install import InstallData
|
|||
from build import InvalidArguments
|
||||
from coredata import MesonException
|
||||
import os, sys, pickle, re
|
||||
import subprocess
|
||||
import subprocess, shutil
|
||||
|
||||
if mesonlib.is_windows():
|
||||
quote_char = '"'
|
||||
|
@ -130,6 +130,33 @@ class NinjaBackend(backends.Backend):
|
|||
raise MesonException('Multiple producers for Ninja target "%s". Please rename your targets.' % n)
|
||||
self.all_outputs[n] = True
|
||||
|
||||
def detect_vs_dep_prefix(self, outfile, tempfilename):
|
||||
'''VS writes its dependency in a locale dependent format.
|
||||
Detect the search prefix to use.'''
|
||||
if shutil.which('cl') is None:
|
||||
return outfile
|
||||
outfile.close()
|
||||
open(os.path.join(self.environment.get_scratch_dir(), 'incdetect.c'),
|
||||
'w').write('''#include<stdio.h>
|
||||
int dummy;
|
||||
''')
|
||||
|
||||
pc = subprocess.Popen(['cl', '/showIncludes', '/c', 'incdetect.c'],
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE,
|
||||
cwd=self.environment.get_scratch_dir())
|
||||
|
||||
(stdo, _) = pc.communicate()
|
||||
|
||||
for line in stdo.split(b'\r\n'):
|
||||
if line.endswith(b'stdio.h'):
|
||||
matchstr = b':'.join(line.split(b':')[0:2]) + b':'
|
||||
binfile = open(tempfilename, 'ab')
|
||||
binfile.write(b'msvc_deps_prefix = ' + matchstr + b'\r\n')
|
||||
binfile.close()
|
||||
return open(tempfilename, 'a')
|
||||
raise MesonException('Could not determine vs dep dependency prefix string.')
|
||||
|
||||
def generate(self, interp):
|
||||
self.interpreter = interp
|
||||
outfilename = os.path.join(self.environment.get_build_dir(), self.ninja_filename)
|
||||
|
@ -140,6 +167,7 @@ class NinjaBackend(backends.Backend):
|
|||
outfile.write('# It is autogenerated by the Meson build system.\n')
|
||||
outfile.write('# Do not edit by hand.\n\n')
|
||||
outfile.write('ninja_required_version = 1.5.1\n\n')
|
||||
outfile = self.detect_vs_dep_prefix(outfile, tempfilename)
|
||||
self.generate_rules(outfile)
|
||||
self.generate_phony(outfile)
|
||||
outfile.write('# Build rules for targets\n\n')
|
||||
|
|
20
run_tests.py
20
run_tests.py
|
@ -153,9 +153,11 @@ def run_configure_inprocess(commandlist):
|
|||
sys.stdout = mystdout = StringIO()
|
||||
old_stderr = sys.stderr
|
||||
sys.stderr = mystderr = StringIO()
|
||||
returncode = meson.run(commandlist)
|
||||
sys.stdout = old_stdout
|
||||
sys.stderr = old_stderr
|
||||
try:
|
||||
returncode = meson.run(commandlist)
|
||||
finally:
|
||||
sys.stdout = old_stdout
|
||||
sys.stderr = old_stderr
|
||||
return (returncode, mystdout.getvalue(), mystderr.getvalue())
|
||||
|
||||
def run_test_inprocess(testdir):
|
||||
|
@ -165,11 +167,13 @@ def run_test_inprocess(testdir):
|
|||
sys.stderr = mystderr = StringIO()
|
||||
old_cwd = os.getcwd()
|
||||
os.chdir(testdir)
|
||||
returncode_test = meson_test.run(['meson-private/meson_test_setup.dat'])
|
||||
returncode_benchmark = meson_benchmark.run(['meson-private/meson_benchmark_setup.dat'])
|
||||
sys.stdout = old_stdout
|
||||
sys.stderr = old_stderr
|
||||
os.chdir(old_cwd)
|
||||
try:
|
||||
returncode_test = meson_test.run(['meson-private/meson_test_setup.dat'])
|
||||
returncode_benchmark = meson_benchmark.run(['meson-private/meson_benchmark_setup.dat'])
|
||||
finally:
|
||||
sys.stdout = old_stdout
|
||||
sys.stderr = old_stderr
|
||||
os.chdir(old_cwd)
|
||||
return (max(returncode_test, returncode_benchmark), mystdout.getvalue(), mystderr.getvalue())
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue