summaryrefslogtreecommitdiff
path: root/obnam
diff options
context:
space:
mode:
authorLars Wirzenius <liw@iki.fi>2008-04-26 22:41:01 +0300
committerLars Wirzenius <liw@iki.fi>2008-04-26 22:41:01 +0300
commit04e39e05a718e363e155a1de7700eecd4712db04 (patch)
tree6c766f54879d4cfae6a416c7d232d9c68b726b15 /obnam
parent980dbe99284ad35ff73732a878cee4551745b63f (diff)
downloadobnam-04e39e05a718e363e155a1de7700eecd4712db04.tar.gz
Remember the list of exclusion strings compiled into regexps, so that we don't unnecessarily re-compile them. If the list changes, forget old regexps.
Diffstat (limited to 'obnam')
-rw-r--r--obnam/app.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/obnam/app.py b/obnam/app.py
index 83b5d428..660cb05b 100644
--- a/obnam/app.py
+++ b/obnam/app.py
@@ -75,11 +75,13 @@ class Application:
config = self.get_context().config
strings = config.getvalues("backup", "exclude")
+ strings = [s.strip() for s in strings if s.strip()]
if self._exclusion_strings != strings:
+ self._exclusion_strings = strings
+ self._exclusion_regexps = []
for string in strings:
- if string:
- logging.debug("Compiling exclusion pattern '%s'" % string)
- self._exclusion_regexps.append(re.compile(string))
+ logging.debug("Compiling exclusion pattern '%s'" % string)
+ self._exclusion_regexps.append(re.compile(string))
return self._exclusion_regexps