This is an automated email from the ASF dual-hosted git repository.

akitouni pushed a commit to branch bst-1
in repository https://gitbox.apache.org/repos/asf/buildstream.git


The following commit(s) were added to refs/heads/bst-1 by this push:
     new 4755665c3 buildstream/utils.py: Fix regex Deprecation Warning
     new 87ce507fc Merge pull request #1774 from nanonyme/regex
4755665c3 is described below

commit 4755665c3665bbaba8794b35acf69f2d7b9a8ac3
Author: Chandan Singh <[email protected]>
AuthorDate: Fri Dec 14 19:25:55 2018 +0000

    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)
    ```
---
 buildstream/utils.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/buildstream/utils.py b/buildstream/utils.py
index f6fc2e70e..4c35d332a 100644
--- a/buildstream/utils.py
+++ b/buildstream/utils.py
@@ -1138,7 +1138,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
@@ -1175,7 +1175,7 @@ def _glob2re(pat):
                 res = '{}[{}]'.format(res, stuff)
         else:
             res = res + re.escape(c)
-    return res + r'\Z(?ms)'
+    return res + r'\Z'
 
 
 # _deduplicate()

Reply via email to