summaryrefslogtreecommitdiff
path: root/buildtools/wafsamba
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2010-04-04 13:08:05 +1000
committerAndrew Tridgell <tridge@samba.org>2010-04-06 20:27:25 +1000
commit553324bc1022635e05a683c4bec5135d845f6fea (patch)
tree7d8aa296c7e433793e47bf1227310973a4aed7e9 /buildtools/wafsamba
parent8dc8d31f4adf84f35bce34339e13e9d70c4b8a66 (diff)
downloadsamba-553324bc1022635e05a683c4bec5135d845f6fea.tar.gz
samba-553324bc1022635e05a683c4bec5135d845f6fea.tar.bz2
samba-553324bc1022635e05a683c4bec5135d845f6fea.zip
s4-waf: move to a universal method of recursing into subdirs
This works with both standalone lib builds and bundled builds
Diffstat (limited to 'buildtools/wafsamba')
-rw-r--r--buildtools/wafsamba/samba_utils.py32
-rw-r--r--buildtools/wafsamba/wafsamba.py12
2 files changed, 32 insertions, 12 deletions
diff --git a/buildtools/wafsamba/samba_utils.py b/buildtools/wafsamba/samba_utils.py
index 07a37aa9e7..37b3fc9dbb 100644
--- a/buildtools/wafsamba/samba_utils.py
+++ b/buildtools/wafsamba/samba_utils.py
@@ -418,3 +418,35 @@ def TOUCH_FILE(file, install_dir=False):
mkdir_p(os.path.dirname(file))
f = open(file, 'w')
f.close()
+
+
+
+@conf
+def RECURSE(ctx, directory):
+ '''recurse into a directory, relative to the curdir or top level'''
+ try:
+ visited_dirs = ctx.visited_dirs
+ except:
+ visited_dirs = ctx.visited_dirs = set()
+ d = os.path.join(ctx.curdir, directory)
+ if os.path.exists(d):
+ abspath = os.path.abspath(d)
+ else:
+ abspath = os.path.abspath(os.path.join(Utils.g_module.srcdir, directory))
+ ctxclass = ctx.__class__.__name__
+ key = ctxclass + ':' + abspath
+ if key in visited_dirs:
+ # already done it
+ return
+ visited_dirs.add(key)
+ relpath = os_path_relpath(abspath, ctx.curdir)
+ if ctxclass == 'Handler':
+ return ctx.sub_options(relpath)
+ if ctxclass == 'ConfigurationContext':
+ return ctx.sub_config(relpath)
+ if ctxclass == 'BuildContext':
+ return ctx.add_subdirs(relpath)
+ print 'Unknown RECURSE context class', ctxclass
+ raise
+Options.Handler.RECURSE = RECURSE
+Build.BuildContext.RECURSE = RECURSE
diff --git a/buildtools/wafsamba/wafsamba.py b/buildtools/wafsamba/wafsamba.py
index f9cb1a882f..55dfe26b0a 100644
--- a/buildtools/wafsamba/wafsamba.py
+++ b/buildtools/wafsamba/wafsamba.py
@@ -442,18 +442,6 @@ Build.BuildContext.SAMBA_GENERATOR = SAMBA_GENERATOR
-def BUILD_SUBDIR(bld, dir):
- '''add a new set of build rules from a subdirectory'''
- path = os.path.normpath(bld.curdir + '/' + dir)
- cache = LOCAL_CACHE(bld, 'SUBDIR_LIST')
- if path in cache: return
- cache[path] = True
- debug("build: Processing subdirectory %s" % dir)
- bld.add_subdirs(dir)
-Build.BuildContext.BUILD_SUBDIR = BUILD_SUBDIR
-
-
-
@runonce
def SETUP_BUILD_GROUPS(bld):
'''setup build groups used to ensure that the different build