def get_param(self, key, action=None, manifest=None):
"""Returns a string value of a given pkglint parameter,
intended for use by pkglint Checker objects to provide hints as
to how particular checks should be run.
Keys are searched for first in the action, if provided, then as
manifest attributes, finally falling back to the pkglintrc
config file.
The return value is a space-separated string of parameters.
When searching for keys in the manifest or action, we prepend
"pkg.lint" to the key name to ensure that we play in our own
namespace and don't clash with other manifest or action attrs.
"""
param_key = "pkg.lint.{0}".format(key)
val = None
if action and param_key in action.attrs:
val = action.attrs[param_key]
if manifest and param_key in manifest:
val = manifest[param_key]
if val:
if isinstance(val, six.string_types):
return val
else:
return " ".join(val)
try:
val = self.conf.get("pkglint", key)
if val:
return val.replace("\n", " ")
except configparser.NoOptionError:
return None
评论列表
文章目录