From 394533ce12434f3b91fc3d82204c17ff1252bfc6 Mon Sep 17 00:00:00 2001 From: Bogdano Arendartchuk Date: Mon, 13 Feb 2006 19:23:10 +0000 Subject: - added function get_helper, which obtains the path of a helper script using information provided in configuration file(s). --- RepSys/util.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'RepSys/util.py') diff --git a/RepSys/util.py b/RepSys/util.py index c39d3ac..d539b81 100644 --- a/RepSys/util.py +++ b/RepSys/util.py @@ -76,6 +76,21 @@ def mapurl(url): except re.error, errmsg: log.error("error in URL mapping regexp: %s", errmsg) return newurl + + +def get_helper(name): + """Tries to find the path of a helper script + + It first looks if the helper has been explicitly defined in + configuration, if not, falls back to the default helper path, which can + also be defined in configuration file(s). + """ + helperdir = config.get("helper", "prefix", "/usr/share/repsys") + hpath = config.get("helper", name, None) or \ + os.path.join(helperdir, name) + if not os.path.isfile(hpath): + log.warn("providing unexistent helper: %s", hpath) + return hpath # vim:et:ts=4:sw=4 -- cgit v1.2.1