From a892d8725accab66b0f3583c92b1b5618dfed9fa Mon Sep 17 00:00:00 2001 From: Thomas Nagy Date: Sun, 20 Nov 2016 13:43:00 +0100 Subject: [PATCH] Force files into the build directory by default --- ChangeLog | 1 + TODO | 2 +- waflib/Node.py | 26 ++++++++------------------ 3 files changed, 10 insertions(+), 19 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6409b45e..28e3287d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,4 +2,5 @@ NEW IN WAF 2.0.0 ---------------- * Keep sorted lists in TaskGen.prec[] * Removed ut_fun from waf_unit_test.py +* Force files into the build directory by default diff --git a/TODO b/TODO index af179317..7472fff2 100644 --- a/TODO +++ b/TODO @@ -3,6 +3,6 @@ Waf 2.0 Merge mem_reducer.py in the mainline Improve the sorting in TaskGen.post() -Default to force files into the build directory Remove ut_exec, ut_cmd from waf_unit_test.py +Better logging? diff --git a/waflib/Node.py b/waflib/Node.py index eba07551..6036265f 100644 --- a/waflib/Node.py +++ b/waflib/Node.py @@ -779,29 +779,19 @@ class Node(object): def find_or_declare(self, lst): """ - Use this method in the build phase to declare output files. + Use this method in the build phase to declare output files which + are meant to be written in the build directory. - If 'self' is in build directory, it first tries to return an existing node object. - If no Node is found, it tries to find one in the source directory. - If no Node is found, a new Node object is created in the build directory, and the - intermediate folders are added. + This method creates the Node object and its parent folder + as needed. :param lst: relative path :type lst: string or list of string """ - if isinstance(lst, str): - lst = [x for x in Utils.split_path(lst) if x and x != '.'] - - node = self.get_bld().search_node(lst) - if node: - if not os.path.isfile(node.abspath()): - node.parent.mkdir() - return node - self = self.get_src() - node = self.find_node(lst) - if node: - return node - node = self.get_bld().make_node(lst) + if os.path.isabs(lst): + node = self.ctx.root.make_node(lst) + else: + node = self.get_bld().make_node(lst) node.parent.mkdir() return node