From: Andrew Gaffney Date: Mon, 12 Jan 2009 03:23:55 +0000 (-0600) Subject: Move addl_arg_parse() from catalyst.support to catalyst.util X-Git-Tag: CATALYST-2.0.10~3^2~182 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=a1004ec11dcf5aea4921e3be65bbb8a0c9f1886e;p=catalyst.git Move addl_arg_parse() from catalyst.support to catalyst.util --- diff --git a/modules/catalyst/support.py b/modules/catalyst/support.py index 5e196349..f446438f 100644 --- a/modules/catalyst/support.py +++ b/modules/catalyst/support.py @@ -44,18 +44,3 @@ that the order of multiple-value items is preserved, but the order that the item defined are not preserved. In other words, "foo", "bar", "oni" ordering is preserved but "item1" "item2" "item3" ordering is not, as the item strings are stored in a dictionary (hash). """ - -def addl_arg_parse(myspec,addlargs,requiredspec,validspec): - "helper function to help targets parse additional arguments" - global valid_config_file_values - - for x in addlargs.keys(): - if x not in validspec and x not in valid_config_file_values and x not in requiredspec: - raise CatalystError, "Argument \""+x+"\" not recognized." - else: - myspec[x]=addlargs[x] - - for x in requiredspec: - if not x in myspec: - raise CatalystError, "Required argument \""+x+"\" not specified." - diff --git a/modules/catalyst/target/generic.py b/modules/catalyst/target/generic.py index 76cd2ecf..acb29147 100644 --- a/modules/catalyst/target/generic.py +++ b/modules/catalyst/target/generic.py @@ -2,13 +2,12 @@ The toplevel class for generic_stage_target. This is about as generic as we get. """ -import os -from catalyst.support import * +import catalyst class generic_target: def __init__(self,myspec,addlargs): - addl_arg_parse(myspec,addlargs,self.required_values,self.valid_values) + catalyst.util.addl_arg_parse(myspec,addlargs,self.required_values,self.valid_values) self.settings=myspec self.env={} self.env["PATH"]="/bin:/sbin:/usr/bin:/usr/sbin" diff --git a/modules/catalyst/util.py b/modules/catalyst/util.py index 8fa9ac31..d516b1f5 100644 --- a/modules/catalyst/util.py +++ b/modules/catalyst/util.py @@ -176,3 +176,17 @@ def read_makeconf(mymakeconffile): makeconf={} return makeconf +def addl_arg_parse(myspec,addlargs,requiredspec,validspec): + "helper function to help targets parse additional arguments" + global valid_config_file_values + + for x in addlargs.keys(): + if x not in validspec and x not in valid_config_file_values and x not in requiredspec: + raise CatalystError, "Argument \""+x+"\" not recognized." + else: + myspec[x]=addlargs[x] + + for x in requiredspec: + if not x in myspec: + raise CatalystError, "Required argument \""+x+"\" not specified." +