Mercurial > gnulib
changeset 19343:c38994dbeca6
config: ignore non-existent cache files
author | Dmitry Selyutin <ghostmansd@gmail.com> |
---|---|
date | Tue, 03 Oct 2017 10:43:57 +0300 |
parents | 5cdc7e8589ed |
children | cb6990a52e11 |
files | pygnulib/config.py |
diffstat | 1 files changed, 11 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/pygnulib/config.py Tue Oct 03 10:42:52 2017 +0300 +++ b/pygnulib/config.py Tue Oct 03 10:43:57 2017 +0300 @@ -535,18 +535,22 @@ def __init__(self, configure=None, **kwargs): super().__init__(**kwargs) - explicit = kwargs.keys() if configure is None: configure = _os_.path.join(self.root, "configure.ac") if not _os_.path.exists(configure): configure = _os_.path.join(self.root, "configure.in") if not _os_.path.isabs(configure): configure = _os_.path.join(self.root, configure) - self.__autoconf(_os_.path.normpath(configure), explicit) - self.__gnulib_cache(explicit) - self.__gnulib_comp(explicit) + kwargs = {"configure": _os_.path.normpath(configure), "explicit": tuple(kwargs.keys())} + calls = (self.__configure_ac, self.__gnulib_cache, self.__gnulib_comp) + for call in calls: + try: + call(**kwargs) + except FileNotFoundError: + pass # ignore non-existent files - def __autoconf(self, configure, explicit): + + def __configure_ac(self, configure, explicit, **kwargs): with _codecs_.open(configure, "rb", "UTF-8") as stream: data = Cache._COMMENTS_.sub("", stream.read()) for (key, pattern) in Cache._AUTOCONF_.items(): @@ -554,7 +558,7 @@ if match and key not in explicit: self[key] = match[-1] - def __gnulib_cache(self, explicit): + def __gnulib_cache(self, explicit, **kwargs): m4_base = self.m4_base path = _os_.path.join(self.root, self.m4_base, "gnulib-cache.m4") path = _os_.path.normpath(path) @@ -581,7 +585,7 @@ if m4_base != self.m4_base: raise _M4BaseMismatchError_(path, m4_base, self.m4_base) - def __gnulib_comp(self, explicit): + def __gnulib_comp(self, explicit, **kwargs): macro_prefix = self.macro_prefix path = _os_.path.join(self.root, self.m4_base, "gnulib-comp.m4") path = _os_.path.normpath(path)