diff options
author | Daniel Silverstone <daniel.silverstone@codethink.co.uk> | 2012-10-04 11:11:32 +0100 |
---|---|---|
committer | Daniel Silverstone <daniel.silverstone@codethink.co.uk> | 2012-10-04 11:11:32 +0100 |
commit | 01064514a4ef9d7062c34faef23bfb8002bbcc4f (patch) | |
tree | 86810bcde0cd8761ab4ddb414bce29620699e982 | |
parent | fc205e8818d4d00119f930a4606df8c4d72651a3 (diff) | |
download | lorry-controller-01064514a4ef9d7062c34faef23bfb8002bbcc4f.tar.gz |
Support ignore glob patterns intead of only exact matches
-rw-r--r-- | lorrycontroller/confparser.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lorrycontroller/confparser.py b/lorrycontroller/confparser.py index 188ac6b..34b4eda 100644 --- a/lorrycontroller/confparser.py +++ b/lorrycontroller/confparser.py @@ -7,6 +7,7 @@ import re import glob import os import time +import fnmatch default_values = [ ( u'create', u'never' ), @@ -201,6 +202,12 @@ class LorryControllerConfig(object): # Pass through unchanged state['last-ls-output'] = state.get('last-ls-output', []) + def ignored(reponame): + for pattern in trove['ignore']: + if fnmatch.fnmatch(reponame, pattern): + return True + return False + # 2. For every entry in last-ls-output, construct a lorry if we want it lorries_made = set() for remotereponame in state['last-ls-output']: @@ -209,8 +216,7 @@ class LorryControllerConfig(object): if remotereponame.startswith(remote+"/"): localreponame = "%s/%s" % (local, remotereponame[len(remote)+1:]) - if ((remotereponame not in trove['ignore']) and - (localreponame is not None)): + if ((not ignored(remotereponame)) and (localreponame is not None)): # Construct a lorry for this one. lorry = { "type": "git", |