summaryrefslogtreecommitdiff
path: root/buildtools
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2010-03-07 15:17:46 +1100
committerAndrew Tridgell <tridge@samba.org>2010-04-06 20:26:42 +1000
commit39807fd091e8feffb5d6ec089409d36e35ef7f28 (patch)
tree75d0078a27e89b313c7e16e86ae25f1b2a7a7e65 /buildtools
parentdd05b6512ab2d5c8fc2d0fe18fcd19b62fee6f01 (diff)
downloadsamba-39807fd091e8feffb5d6ec089409d36e35ef7f28.tar.gz
samba-39807fd091e8feffb5d6ec089409d36e35ef7f28.tar.bz2
samba-39807fd091e8feffb5d6ec089409d36e35ef7f28.zip
build: smarter list splitting
Diffstat (limited to 'buildtools')
-rw-r--r--buildtools/wafsamba/samba_pidl.py2
-rw-r--r--buildtools/wafsamba/samba_utils.py11
-rw-r--r--buildtools/wafsamba/wafsamba.py18
3 files changed, 16 insertions, 15 deletions
diff --git a/buildtools/wafsamba/samba_pidl.py b/buildtools/wafsamba/samba_pidl.py
index a108e03991..42652b66d7 100644
--- a/buildtools/wafsamba/samba_pidl.py
+++ b/buildtools/wafsamba/samba_pidl.py
@@ -85,7 +85,7 @@ Build.BuildContext.SAMBA_PIDL_TDR = SAMBA_PIDL_TDR
#################################################################
# define a set of Samba PIDL targets
def SAMBA_PIDL_LIST(bld, name, source,options=''):
- for p in source.split():
+ for p in to_list(source):
bld.SAMBA_PIDL(name, p, options)
Build.BuildContext.SAMBA_PIDL_LIST = SAMBA_PIDL_LIST
diff --git a/buildtools/wafsamba/samba_utils.py b/buildtools/wafsamba/samba_utils.py
index 333477e499..6fef84f2da 100644
--- a/buildtools/wafsamba/samba_utils.py
+++ b/buildtools/wafsamba/samba_utils.py
@@ -6,6 +6,7 @@ from TaskGen import feature, before
from Configure import conf
from Logs import debug
from TaskGen import extension
+import shlex
LIB_PATH="shared"
@@ -109,7 +110,7 @@ Build.BuildContext.ASSERT = ASSERT
# create a list of files by pre-pending each with a subdir name
def SUBDIR(bld, subdir, list):
ret = ''
- for l in list.split():
+ for l in to_list(list):
ret = ret + subdir + '/' + l + ' '
return ret
Build.BuildContext.SUBDIR = SUBDIR
@@ -117,7 +118,7 @@ Build.BuildContext.SUBDIR = SUBDIR
##############################################
# remove .. elements from a path list
def NORMPATH(bld, ilist):
- return " ".join([os.path.normpath(p) for p in ilist.split(" ")])
+ return " ".join([os.path.normpath(p) for p in to_list(ilist)])
Build.BuildContext.NORMPATH = NORMPATH
#######################################################
@@ -229,3 +230,9 @@ def dbg(self):
if self.target == 'HEIMDAL_HEIM_ASN1':
print "@@@@@@@@@@@@@@2", self.includes, self.env._CCINCFLAGS
+
+def to_list(str):
+ '''Split a list, preserving quoted strings and existing lists'''
+ if isinstance(str, list):
+ return str
+ return shlex.split(str)
diff --git a/buildtools/wafsamba/wafsamba.py b/buildtools/wafsamba/wafsamba.py
index 7686a891b2..30324f7d7a 100644
--- a/buildtools/wafsamba/wafsamba.py
+++ b/buildtools/wafsamba/wafsamba.py
@@ -27,12 +27,6 @@ def SAMBA_BUILD_ENV(conf):
if not os.path.exists(libpath):
os.mkdir(libpath)
-##############################################
-# remove .. elements from a path list
-def NORMPATH(bld, ilist):
- return " ".join([os.path.normpath(p) for p in ilist.split(" ")])
-Build.BuildContext.NORMPATH = NORMPATH
-
################################################################
# add an init_function to the list for a subsystem
def ADD_INIT_FUNCTION(bld, subsystem, init_function):
@@ -102,7 +96,7 @@ def ADD_DEPENDENCIES(bld, name, deps):
lib_deps = LOCAL_CACHE(bld, 'LIB_DEPS')
if not name in lib_deps:
lib_deps[name] = {}
- list = deps.split()
+ list = to_list(deps)
list2 = []
for d in list:
lib_deps[name][d] = True;
@@ -161,9 +155,9 @@ def ADD_DEPENDENCIES(bld, name, deps):
if recurse and (d in lib_deps):
rec_deps = ' '.join(lib_deps[d].keys())
(rec_sysdeps, rec_localdeps, rec_add_objects) = ADD_DEPENDENCIES(bld, d, rec_deps)
- sysdeps.extend(rec_sysdeps.split())
- localdeps.extend(rec_localdeps.split())
- add_objects.extend(rec_add_objects.split())
+ sysdeps.extend(to_list(rec_sysdeps))
+ localdeps.extend(to_list(rec_localdeps))
+ add_objects.extend(to_list(rec_add_objects))
debug('deps: Dependencies for %s: sysdeps: %u localdeps: %u add_objects=%u' % (
name, len(sysdeps), len(localdeps), len(add_objects)))
@@ -175,7 +169,7 @@ def ADD_DEPENDENCIES(bld, name, deps):
def SAMBA_LIBRARY_INCLUDE_LIST(bld, deps):
ret = bld.curdir + ' '
cache = LOCAL_CACHE(bld, 'INCLUDE_LIST')
- for l in deps.split():
+ for l in to_list(deps):
if l in cache:
ret = ret + cache[l] + ' '
if 'EXTRA_INCLUDES' in bld.env:
@@ -272,7 +266,7 @@ def SAMBA_BINARY(bld, binname, source,
cache = LOCAL_CACHE(bld, 'INIT_FUNCTIONS')
if modules is not None:
- for m in modules.split():
+ for m in to_list(modules):
bld.ASSERT(m in cache,
"No init_function defined for module '%s' in binary '%s'" % (m, binname))
cflags += ' -DSTATIC_%s_MODULES="%s"' % (m, cache[m])