summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChandan Singh <csingh43@bloomberg.net>2018-12-14 19:25:55 +0000
committerChandan Singh <chandan@chandansingh.net>2018-12-20 15:53:12 +0000
commite8055a56d265d558248557782fa3ed0e6419caa4 (patch)
treefa91345c1c918336d656c6a6f4a888a2b372f0cd
parentc05d8b4f08dd5d3c661db98d26b93f221d49e371 (diff)
downloadbuildstream-e8055a56d265d558248557782fa3ed0e6419caa4.tar.gz
buildstream/utils.py: Fix regex Deprecation 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()