diff options
Diffstat (limited to 'BuildTools/scons2ninja.py')
| -rwxr-xr-x | BuildTools/scons2ninja.py | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/BuildTools/scons2ninja.py b/BuildTools/scons2ninja.py index 6c77c88..df4c655 100755 --- a/BuildTools/scons2ninja.py +++ b/BuildTools/scons2ninja.py @@ -1,7 +1,7 @@ #!/usr/bin/env python -# -*- coding: utf-8 -*- +# -*- coding: utf-8 -*- ################################################################################ # # scons2ninja: A script to create a Ninja build file from SCons. # @@ -202,13 +202,13 @@ class NinjaBuilder : return result def to_string(self, lst, quote = False) : if is_list(lst) : if quote : - return ' '.join([quote_spaces(x) for x in lst]) + return ' '.join([quote_spaces(x) for x in lst]) else : - return ' '.join([escape(x) for x in lst]) + return ' '.join([escape(x) for x in lst]) if is_regexp(lst) : return ' '.join([escape(x) for x in self.targets if lst.match(x)]) return escape(lst) def get_flags_variable(self, flags_type, flags) : @@ -246,12 +246,12 @@ scons_dependencies = [os.path.normpath(x) for x in scons_dependencies] ninja = NinjaBuilder() ninja.pool('scons_pool', depth = 1) if sys.platform == 'win32' : - ninja.rule('cl', - deps = 'msvc', + ninja.rule('cl', + deps = 'msvc', command = '$cl /showIncludes $clflags -c $in /Fo$out', description = 'CXX $out') ninja.rule('link', command = '$link $in $linkflags $libs /out:$out', @@ -367,11 +367,11 @@ stack = ['.'] for line in f.stdout : line = line.rstrip() # Skip lines if requested from previous command if skip_nth_line >= 0 : - skip_nth_line -= 1 + skip_nth_line -= 1 if skip_nth_line == 0 : continue if line.startswith('scons: done building targets') : break @@ -405,11 +405,11 @@ for line in f.stdout : continue level = line.index('+-') / 2 filename = line[level*2+2:] if filename.startswith('[') : - filename = filename[1:-1] + filename = filename[1:-1] # Check if we use the 'fixed' format which escapes filenamenames if filename.startswith('\'') and filename.endswith('\'') : filename = eval(filename) @@ -427,11 +427,11 @@ for line in f.stdout : dependencies[target] = [] dependencies[target].append(filename) previous_filename = filename if f.wait() != 0 : - print "Error calling '" + scons_generate_cmd + "'" + print("Error calling '" + scons_generate_cmd + "'") print f.stderr.read() exit(-1) # Pass 2: Parse build rules tools = {} @@ -526,14 +526,14 @@ for line in build_lines : out, flags = extract_unary_flag("/out:", flags) libs, flags = partition(flags, lambda x: not x.startswith("/") and x.endswith(".lib")) libpaths = get_unary_flags("/libpath:", flags) deps = get_built_libs(libs, libpaths, ninja.targets) if out in mtflags : - ninja.build(out, 'link_mt', objects, deps = sorted(deps), + ninja.build(out, 'link_mt', objects, deps = sorted(deps), libs = libs, linkflags = flags, mtflags = mtflags[out]) else : - ninja.build(out, 'link', objects, deps = sorted(deps), + ninja.build(out, 'link', objects, deps = sorted(deps), libs = libs, linkflags = flags) elif tool == 'rc': out, flags = extract_unary_flag("/fo", flags) files, flags = extract_non_flags(flags) @@ -587,14 +587,16 @@ for line in build_lines : elif tool == 'sdef' : source = flags[0]; outdir, flags = extract_binary_flag("-o", flags) basename, flags = extract_binary_flag("--basename", flags) - ninja.build(os.path.join(outdir, basename + ".h"), 'sdef', [source], + ninja.build(os.path.join(outdir, basename + ".h"), 'sdef', [source], basename = basename, outdir = outdir) + elif tool == 'checker': + pass elif not ninja_custom_command(ninja, line) : raise Exception("Unknown tool: '" + line + "'") |
Swift