Mercurial > gnulib
changeset 38947:3c2f99db15b0
config/cache: simplify regular expressions
author | Dmitry Selyutin <ghostmansd@gmail.com> |
---|---|
date | Tue, 12 Sep 2017 19:47:11 +0300 |
parents | 3e197739b3df |
children | 23d583eb2673 |
files | pygnulib/config.py |
diffstat | 1 files changed, 5 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/pygnulib/config.py Tue Sep 12 00:28:07 2017 +0300 +++ b/pygnulib/config.py Tue Sep 12 19:47:11 2017 +0300 @@ -430,9 +430,9 @@ class Cache(Base): """gnulib cached configuration""" _AUTOCONF_ = { - "autoconf" : _re_.compile(".*AC_PREREQ\\(\\[(.*?)\\]\\)", _re_.S | _re_.M), - "auxdir" : _re_.compile("^AC_CONFIG_AUX_DIR\\(\\[(.*?)\\]\\)$", _re_.S | _re_.M), - "libtool" : _re_.compile("A[CM]_PROG_LIBTOOL", _re_.S | _re_.M) + "autoconf" : _re_.compile(r"AC_PREREQ\(\[(.*?)\]\)", _re_.S | _re_.M), + "auxdir" : _re_.compile(r"AC_CONFIG_AUX_DIR\(\[(.*?)\]\)$", _re_.S | _re_.M), + "libtool" : _re_.compile(r"A[CM]_PROG_LIBTOOL", _re_.S | _re_.M) } _GNULIB_CACHE_ = { "local" : (str, "gl_LOCAL_DIR"), @@ -470,7 +470,7 @@ _GNULIB_CACHE_STR_ += [_key_] else: _GNULIB_CACHE_LIST_ += [_key_] - _GNULIB_CACHE_PATTERN_ = _re_.compile("^(gl_.*?)\\(\\[(.*?)\\]\\)$", _re_.S | _re_.M) + _GNULIB_CACHE_PATTERN_ = _re_.compile(r"^(gl_.*?)\(\[(.*?)\]\)$", _re_.S | _re_.M) def __init__(self, root, m4_base, autoconf=None, **kwargs): @@ -526,7 +526,7 @@ raise FileNotFoundError(path) with _codecs_.open(path, "rb", "UTF-8") as stream: data = stream.read() - regex = "AC_DEFUN\\(\\[%s_FILE_LIST\\], \\[(.*?)\\]\\)" % self["macro-prefix"] + regex = r"AC_DEFUN\(\[%s_FILE_LIST\], \[(.*?)\]\)".format(self["macro-prefix"]) pattern = _re_.compile(regex, _re_.S | _re_.M) match = pattern.findall(data) if match: