From 04e39e05a718e363e155a1de7700eecd4712db04 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Sat, 26 Apr 2008 22:41:01 +0300 Subject: 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. --- obnam/app.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'obnam') 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 -- cgit v1.2.1