From 0454ee677e58476db7b1338692d121d1cca290e1 Mon Sep 17 00:00:00 2001 From: Thomas Nagy Date: Tue, 8 Nov 2016 21:29:46 +0100 Subject: [PATCH] docs --- TODO | 8 ++++++++ waflib/extras/force_build_directory.py | 27 ++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 waflib/extras/force_build_directory.py diff --git a/TODO b/TODO index cf644780..2d14a802 100644 --- a/TODO +++ b/TODO @@ -3,3 +3,11 @@ Waf 1.9 Documentation +Waf 2.0 +------- + +Merge mem_reducer.py in the mainline +Keep sorted lists in TaskGen.prec[] +Improve the sorting in TaskGen.post() +Default to force files into the build directory + diff --git a/waflib/extras/force_build_directory.py b/waflib/extras/force_build_directory.py new file mode 100644 index 00000000..90ab9759 --- /dev/null +++ b/waflib/extras/force_build_directory.py @@ -0,0 +1,27 @@ +#!/usr/bin/env python +# coding=utf-8 +# Thomas Nagy, 2016 + +""" +Force all build files to go to the build directory: + + def options(opt): + opt.load('force_build_directory') + +""" + +from waflib import Node, Utils + +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) + node.parent.mkdir() + return node +Node.Node.find_or_declare = find_or_declare