summaryrefslogtreecommitdiff
path: root/obnamlib/plugins/exclude_pathnames_plugin.py
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2015-04-03 13:44:56 +0300
committerLars Wirzenius <liw@liw.fi>2015-04-03 13:44:56 +0300
commitc54f87a63121e0828313739c4a557c50f1fd3691 (patch)
treed1f9425a4ca4c9e7c1af21d682fd1f3eccab97ba /obnamlib/plugins/exclude_pathnames_plugin.py
parent561514d7c5d40e68a57e1ef4e88af9034739f5fc (diff)
downloadobnam-c54f87a63121e0828313739c4a557c50f1fd3691.tar.gz
Move --exclude-caches to plugin
Diffstat (limited to 'obnamlib/plugins/exclude_pathnames_plugin.py')
-rw-r--r--obnamlib/plugins/exclude_pathnames_plugin.py14
1 files changed, 6 insertions, 8 deletions
diff --git a/obnamlib/plugins/exclude_pathnames_plugin.py b/obnamlib/plugins/exclude_pathnames_plugin.py
index 92acd7c8..8b19985f 100644
--- a/obnamlib/plugins/exclude_pathnames_plugin.py
+++ b/obnamlib/plugins/exclude_pathnames_plugin.py
@@ -48,17 +48,15 @@ class ExcludePathnamesPlugin(obnamlib.ObnamPlugin):
'(can be used multiple times)',
group=backup_group)
- self.app.hooks.add_callback('backup-exclude', self.exclude)
+ self.app.hooks.add_callback('config-loaded', self.config_loaded)
+ def config_loaded(self):
+ self.app.hooks.add_callback('backup-exclude', self.exclude)
self.pathname_excluder = obnamlib.PathnameExcluder()
- self.init_done = False
-
- def exclude(self, pathname=None, stat_result=None, exclude=None):
- if not self.init_done:
- self.compile_exclusion_patterns()
- self.compile_inclusion_patterns()
- self.init_done = True
+ self.compile_exclusion_patterns()
+ self.compile_inclusion_patterns()
+ def exclude(self, fs=None, pathname=None, stat_result=None, exclude=None):
is_excluded, regexp = self.pathname_excluder.exclude(pathname)
if is_excluded:
logging.debug('Exclude (pattern): %s', pathname)