summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChandan Singh <csingh43@bloomberg.net>2018-12-14 19:25:55 +0000
committerChandan Singh <csingh43@bloomberg.net>2018-12-14 19:29:25 +0000
commitef524b3d309df7c5cbfb5452f0f885e4876ef653 (patch)
tree5f1e1a26f0841402f0a54d26237b879e0042b56b
parentd960a33762c80f4d286b64fcf65a2f884fe66c1c (diff)
downloadbuildstream-chandan/fix-warning.tar.gz
buildstream/utils.py: Fix regex Deprecation Warningchandan/fix-warning
Specify flags at the start of the expression as per the recommendation of the standard library. Without this patch, we currently get the following warning: ``` tests/examples/junctions.py::test_open_cross_junction_workspace /builds/BuildStream/buildstream/dist/buildstream/buildstream/utils.py:213: DeprecationWarning: Flags not at the start of the expression '\\/[^/]*\\Z(?ms)' regexer = re.compile(expression) ```
-rw-r--r--buildstream/utils.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/buildstream/utils.py b/buildstream/utils.py
index 4da29c259..a4600319b 100644
--- a/buildstream/utils.py
+++ b/buildstream/utils.py
@@ -1168,7 +1168,7 @@ def _call(*popenargs, terminate=False, **kwargs):
#
def _glob2re(pat):
i, n = 0, len(pat)
- res = ''
+ res = '(?ms)'
while i < n:
c = pat[i]
i = i + 1
@@ -1205,7 +1205,7 @@ def _glob2re(pat):
res = '{}[{}]'.format(res, stuff)
else:
res = res + re.escape(c)
- return res + r'\Z(?ms)'
+ return res + r'\Z'
# _deduplicate()