summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan van Berkom <tristan@codethink.co.uk>2020-11-11 19:26:22 +0900
committerTristan van Berkom <tristan@codethink.co.uk>2020-11-19 15:41:28 +0900
commit2991a5dd265751c309cbc2b2bbc4c44c3cc3a9d6 (patch)
tree8626df15c5aed750eb64e2121f244e96f44abd9b
parent6fd3b0b9467c9baa83aa959237ce8c8acc7c0d6a (diff)
downloadbuildstream-2991a5dd265751c309cbc2b2bbc4c44c3cc3a9d6.tar.gz
_stream.py: Use consistent glob handling with utils.glob()
Don't use fnmatch(), as this has a different behavior from utils.glob(), which is a bit closer to what we expect from a shell (* matches everything except path separators, while ** matches path separators), and also consistent with other places where BuildStream handles globbing, like when considering split rules. We should not have a different globbing behavior than split rules for the command line.
-rw-r--r--src/buildstream/_stream.py9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/buildstream/_stream.py b/src/buildstream/_stream.py
index e97fa5f18..91d7cb122 100644
--- a/src/buildstream/_stream.py
+++ b/src/buildstream/_stream.py
@@ -27,7 +27,6 @@ import shutil
import tarfile
import tempfile
from contextlib import contextmanager, suppress
-from fnmatch import fnmatch
from collections import deque
from typing import List, Tuple
@@ -1624,11 +1623,9 @@ class Stream:
for glob in globs:
matched = False
- for element_path in all_elements:
- if fnmatch(element_path, glob):
- element_targets.append(element_path)
- matched = True
-
+ for element_path in utils.glob(all_elements, glob):
+ element_targets.append(element_path)
+ matched = True
if matched:
globs[glob] = globs[glob] + 1