aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbackends.py10
-rwxr-xr-xenvironment.py3
2 files changed, 10 insertions, 3 deletions
diff --git a/backends.py b/backends.py
index 6637156..fd13492 100755
--- a/backends.py
+++ b/backends.py
@@ -19,6 +19,11 @@ import interpreter, nodes
import environment
from meson_install import InstallData
+if environment.is_windows():
+ quote_char = '"'
+else:
+ quote_char = "'"
+
def shell_quote(cmdlist):
return ["'" + x + "'" for x in cmdlist]
@@ -210,7 +215,7 @@ class NinjaBuildElement():
if name == 'DEPFILE' or name == 'DESC':
should_quote = False
line = ' %s = ' % name
- q_templ = "'%s'"
+ q_templ = quote_char + "%s" + quote_char
noq_templ = "%s"
newelems = []
for i in elems:
@@ -407,13 +412,14 @@ class NinjaBackend(Backend):
outfile.write('\n')
def generate_compile_rules(self, outfile):
+ qstr = quote_char + "%s" + quote_char
for compiler in self.build.compilers:
langname = compiler.get_language()
rule = 'rule %s_COMPILER\n' % langname
depflags = compiler.get_dependency_gen_flags('$out', '$DEPFILE')
command = " command = %s $FLAGS %s %s $out %s $in\n" % \
(' '.join(compiler.get_exelist()),\
- ' '.join(['\'%s\''% d for d in depflags]),\
+ ' '.join([qstr % d for d in depflags]),\
' '.join(compiler.get_output_flags()),\
' '.join(compiler.get_compile_only_flags()))
description = ' description = Compiling %s object $out\n' % langname
diff --git a/environment.py b/environment.py
index 85ffd17..b8fa5ce 100755
--- a/environment.py
+++ b/environment.py
@@ -228,6 +228,7 @@ def is_osx():
return platform.system().lower() == 'darwin'
def is_windows():
+ print(platform.system().lower())
return platform.system().lower() == 'windows'
header_suffixes = ['h', 'hh', 'hpp', 'hxx', 'H']
@@ -237,7 +238,7 @@ class Environment():
coredata_file = os.path.join(private_dir, 'coredata.dat')
def __init__(self, source_dir, build_dir, main_script_file, options):
- assert(main_script_file[0] == '/')
+ assert(os.path.isabs(main_script_file))
assert(not os.path.islink(main_script_file))
self.source_dir = source_dir
self.build_dir = build_dir