diff options
author | Jon Turney <jon.turney@dronecode.org.uk> | 2020-02-14 16:34:12 +0000 |
---|---|---|
committer | Jon Turney <jon.turney@dronecode.org.uk> | 2020-02-28 11:54:05 +0000 |
commit | d1bd4ccf6e895dd403ef7f69605c75f636a95926 (patch) | |
tree | f3fd1aa0dce89171c883f44523330a6f4b9c5791 /mesonbuild/rewriter.py | |
parent | c3163040aec7eb1486989369041b8a7d549cd9db (diff) | |
download | meson-d1bd4ccf6e895dd403ef7f69605c75f636a95926.zip meson-d1bd4ccf6e895dd403ef7f69605c75f636a95926.tar.gz meson-d1bd4ccf6e895dd403ef7f69605c75f636a95926.tar.bz2 |
Update rewriter for filename in node location
Diffstat (limited to 'mesonbuild/rewriter.py')
-rw-r--r-- | mesonbuild/rewriter.py | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/mesonbuild/rewriter.py b/mesonbuild/rewriter.py index b634d00..2a65746 100644 --- a/mesonbuild/rewriter.py +++ b/mesonbuild/rewriter.py @@ -651,7 +651,7 @@ class Rewriter: mlog.log(' -- Source', mlog.green(i), 'is already defined for the target --> skipping') continue mlog.log(' -- Adding source', mlog.green(i), 'at', - mlog.yellow('{}:{}'.format(os.path.join(node.subdir, environment.build_filename), node.lineno))) + mlog.yellow('{}:{}'.format(node.subdir, node.lineno))) token = Token('string', node.subdir, 0, 0, 0, None, i) to_append += [StringNode(token)] @@ -695,7 +695,7 @@ class Rewriter: arg_node = root assert(arg_node is not None) mlog.log(' -- Removing source', mlog.green(i), 'from', - mlog.yellow('{}:{}'.format(os.path.join(string_node.subdir, environment.build_filename), string_node.lineno))) + mlog.yellow('{}:{}'.format(string_node.subdir, string_node.lineno))) arg_node.arguments.remove(string_node) # Mark the node as modified @@ -712,23 +712,24 @@ class Rewriter: id_base = re.sub(r'[- ]', '_', cmd['target']) target_id = id_base + '_exe' if cmd['target_type'] == 'executable' else '_lib' source_id = id_base + '_sources' + subdir = os.path.join(cmd['subdir'], environment.build_filename) # Build src list - src_arg_node = ArgumentNode(Token('string', cmd['subdir'], 0, 0, 0, None, '')) + src_arg_node = ArgumentNode(Token('string', subdir, 0, 0, 0, None, '')) src_arr_node = ArrayNode(src_arg_node, 0, 0, 0, 0) - src_far_node = ArgumentNode(Token('string', cmd['subdir'], 0, 0, 0, None, '')) - src_fun_node = FunctionNode(cmd['subdir'], 0, 0, 0, 0, 'files', src_far_node) - src_ass_node = AssignmentNode(cmd['subdir'], 0, 0, source_id, src_fun_node) - src_arg_node.arguments = [StringNode(Token('string', cmd['subdir'], 0, 0, 0, None, x)) for x in cmd['sources']] + src_far_node = ArgumentNode(Token('string', subdir, 0, 0, 0, None, '')) + src_fun_node = FunctionNode(subdir, 0, 0, 0, 0, 'files', src_far_node) + src_ass_node = AssignmentNode(subdir, 0, 0, source_id, src_fun_node) + src_arg_node.arguments = [StringNode(Token('string', subdir, 0, 0, 0, None, x)) for x in cmd['sources']] src_far_node.arguments = [src_arr_node] # Build target - tgt_arg_node = ArgumentNode(Token('string', cmd['subdir'], 0, 0, 0, None, '')) - tgt_fun_node = FunctionNode(cmd['subdir'], 0, 0, 0, 0, cmd['target_type'], tgt_arg_node) - tgt_ass_node = AssignmentNode(cmd['subdir'], 0, 0, target_id, tgt_fun_node) + tgt_arg_node = ArgumentNode(Token('string', subdir, 0, 0, 0, None, '')) + tgt_fun_node = FunctionNode(subdir, 0, 0, 0, 0, cmd['target_type'], tgt_arg_node) + tgt_ass_node = AssignmentNode(subdir, 0, 0, target_id, tgt_fun_node) tgt_arg_node.arguments = [ - StringNode(Token('string', cmd['subdir'], 0, 0, 0, None, cmd['target'])), - IdNode(Token('string', cmd['subdir'], 0, 0, 0, None, source_id)) + StringNode(Token('string', subdir, 0, 0, 0, None, cmd['target'])), + IdNode(Token('string', subdir, 0, 0, 0, None, source_id)) ] src_ass_node.accept(AstIndentationGenerator()) @@ -741,7 +742,7 @@ class Rewriter: to_remove = target['node'] self.to_remove_nodes += [to_remove] mlog.log(' -- Removing target', mlog.green(cmd['target']), 'at', - mlog.yellow('{}:{}'.format(os.path.join(to_remove.subdir, environment.build_filename), to_remove.lineno))) + mlog.yellow('{}:{}'.format(to_remove.subdir, to_remove.lineno))) elif cmd['operation'] == 'info': # T.List all sources in the target @@ -796,7 +797,7 @@ class Rewriter: printer.post_process() new_data = printer.result.strip() data = { - 'file': os.path.join(i['node'].subdir, environment.build_filename), + 'file': i['node'].subdir, 'str': new_data, 'node': i['node'], 'action': i['action'] |