aboutsummaryrefslogtreecommitdiffstats
path: root/RepSys
diff options
context:
space:
mode:
authorBogdano Arendartchuk <bogdano@mandriva.org>2006-02-13 19:23:10 +0000
committerBogdano Arendartchuk <bogdano@mandriva.org>2006-02-13 19:23:10 +0000
commit394533ce12434f3b91fc3d82204c17ff1252bfc6 (patch)
tree54caa391289f1537f11dd79912850f3ec1169376 /RepSys
parenta82183a6b78b934dc1be25a2722bfc271385b4f7 (diff)
downloadmgarepo-394533ce12434f3b91fc3d82204c17ff1252bfc6.tar
mgarepo-394533ce12434f3b91fc3d82204c17ff1252bfc6.tar.gz
mgarepo-394533ce12434f3b91fc3d82204c17ff1252bfc6.tar.bz2
mgarepo-394533ce12434f3b91fc3d82204c17ff1252bfc6.tar.xz
mgarepo-394533ce12434f3b91fc3d82204c17ff1252bfc6.zip
- added function get_helper, which obtains the path of a helper script
using information provided in configuration file(s).
Diffstat (limited to 'RepSys')
-rw-r--r--RepSys/util.py15
1 files changed, 15 insertions, 0 deletions
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