From d28f36d16e515fb1280b21b04bb5bb113647f247 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Wed, 12 Sep 2012 17:06:23 +0200 Subject: build:dist: extend meaning of DIST_FILES to also recurse into directories Pair-Programmed-With: Stefan Metzmacher --- buildtools/wafsamba/samba_dist.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'buildtools/wafsamba') diff --git a/buildtools/wafsamba/samba_dist.py b/buildtools/wafsamba/samba_dist.py index 30902c4f04..82492e135c 100644 --- a/buildtools/wafsamba/samba_dist.py +++ b/buildtools/wafsamba/samba_dist.py @@ -127,6 +127,14 @@ def dist(appname='',version=''): add_tarfile(tar, fname, abspath, srcsubdir) + def list_directory_files(abspath): + out_files = [] + for root, dirs, files in os.walk(abspath): + for f in files: + out_files.append(os.path.join(root, f)) + return out_files + + if not isinstance(appname, str) or not appname: # this copes with a mismatch in the calling arguments for dist() appname = Utils.g_module.APPNAME @@ -175,8 +183,14 @@ def dist(appname='',version=''): absfile = os.path.join(srcdir, file) - fname = dist_base + '/' + destfile - add_tarfile(tar, fname, absfile, destfile) + if os.path.isdir(absfile): + destdir = destfile + dir = file + files = list_directory_files(dir) + add_files_to_tarball(tar, srcdir, dir, dist_base, destdir, blacklist, files) + else: + fname = dist_base + '/' + destfile + add_tarfile(tar, fname, absfile, destfile) tar.close() -- cgit