Simplify waflib/extras/force_build_directory.py

This commit is contained in:
Thomas Nagy 2016-11-20 13:47:31 +01:00
parent c142062d69
commit 6c48f08e97
No known key found for this signature in database
GPG Key ID: 49B4C67C05277AAA
1 changed files with 5 additions and 10 deletions

View File

@ -11,18 +11,13 @@ Force all build files to go to the build directory:
"""
import os
from waflib import Node, Utils
from waflib import Node
def find_or_declare(self, lst):
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
node = self.get_bld().make_node(lst)
if isinstance(lst, str) and os.path.isabs(lst):
node = self.ctx.root.make_node(lst)
else:
node = self.get_bld().make_node(lst)
node.parent.mkdir()
return node
Node.Node.find_or_declare = find_or_declare