diff options
author | kennyballou <kballou@onyx.boisestate.edu> | 2013-01-21 16:41:34 -0700 |
---|---|---|
committer | kennyballou <kballou@onyx.boisestate.edu> | 2013-01-21 16:41:34 -0700 |
commit | d1771d0d435c71217f698331fac2ac03826b57da (patch) | |
tree | 26be56b67673a539cf4337ce751adfcecd704773 /xnt | |
parent | 8971b279e95944db04c8a2e03ff45aa56d6ce525 (diff) | |
download | xnt-d1771d0d435c71217f698331fac2ac03826b57da.tar.gz xnt-d1771d0d435c71217f698331fac2ac03826b57da.tar.xz |
Update Param Passing to not override existing
When passing parameters to build, xenant should only override the
parameters being passed; not the entire dictionary
Diffstat (limited to 'xnt')
-rw-r--r-- | xnt/xenant.py | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/xnt/xenant.py b/xnt/xenant.py index 340cb87..4f98110 100644 --- a/xnt/xenant.py +++ b/xnt/xenant.py @@ -56,7 +56,7 @@ def main(): ec = invokeBuild( __loadBuild(), arg[0] if len(arg) == 1 else "default", - __processParams(params)) + params) from xnt.tasks import rm rm("build.pyc", "__pycache__") @@ -64,12 +64,19 @@ def main(): logger.info("Execution time: %.3f", elapsed_time) print("Success" if ec == 0 else "Failure") -def invokeBuild(build, targetName, props={}): +def invokeBuild(build, targetName, props=[]): + def __getProperties(): + try: + return getattr(build, "properties") + except AttributeError: + return None + if targetName == "list-targets": return printTargets(build) try: if len(props) > 0: - setattr(build, "properties", props) + setattr(build, "properties", __processParams(props, + __getProperties())) target = getattr(build, targetName) ec = target() return ec if ec else 0 @@ -141,8 +148,8 @@ def __loadBuild(path=""): del sys.modules["build"] os.chdir(cwd) -def __processParams(params): - properties = {} +def __processParams(params, buildProperties={}): + properties = buildProperties if buildProperties is not None else {} for p in params: name, value = p[2:].split("=") properties[name] = value |