aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Bachelier <laurent@bachelier.name>2010-01-05 10:33:13 +0100
committerLaurent Bachelier <laurent@bachelier.name>2010-01-05 10:33:13 +0100
commit29e2f344b31b616183747311ccb45ad86e2bd48d (patch)
treee2c64212010e7d7a43922f796f0283edb9787280
parentSupport for conditional dotfiles (diff)
downloadconfman-29e2f344b31b616183747311ccb45ad86e2bd48d.tar.xz
ignore() function for ProgrammableConfigAction
-rw-r--r--confman.py17
1 files changed, 14 insertions, 3 deletions
diff --git a/confman.py b/confman.py
index 98f0552..d118c11 100644
--- a/confman.py
+++ b/confman.py
@@ -86,13 +86,20 @@ class ProgrammableConfigAction(ConfigAction):
def __init__(self, filename):
self.filename = filename
+ class IgnoreForwarder(Exception):
+ pass
+
def redirect(filename):
raise SymlinkForwarder("_"+filename)
+ def ignore():
+ raise IgnoreForwarder()
+
exec_env = \
{
"options": self.config.options,
- "redirect": redirect
+ "redirect": redirect,
+ "ignore": ignore,
}
source = self.source_path()
@@ -101,13 +108,17 @@ class ProgrammableConfigAction(ConfigAction):
in exec_env
except SymlinkForwarder as e:
self.proxy = SymlinkConfigAction(self.config, self.relpath, e.filename, self.dest)
+ except IgnoreForwarder as e:
+ self.proxy = None
else:
raise Exception("Unknown result")
- return self.proxy.check()
+ if not self.proxy is None:
+ return self.proxy.check()
def sync(self):
- return self.proxy.sync()
+ if not self.proxy is None:
+ return self.proxy.sync()
def __repr__(self):
return self.__class__.__name__+': '+self.source+' => PROXY '+repr(self.proxy)