diff --git a/gnulib-tool.py b/gnulib-tool.py index f61654039..8137ea3eb 100644 --- a/gnulib-tool.py +++ b/gnulib-tool.py @@ -922,7 +922,7 @@ def main(): if __name__ == '__main__': try: # Try to execute main() - except classes.GLError as error: + except BaseException as error: errmode = 0 # gnulib-style errors errno = error.errno errinfo = error.errinfo diff --git a/pygnulib/GLConfig.py b/pygnulib/GLConfig.py index 6470ff53f..ef997179c 100644 --- a/pygnulib/GLConfig.py +++ b/pygnulib/GLConfig.py @@ -281,6 +281,10 @@ class GLConfig(object): result = self.table[y] if type(y) is list: result = list(self.table[y]) + if y == "auxdir": + if self.table['auxdir']: + return self.table['auxdir'] + return "build-aux" return(self.table[y]) else: # if y not in self.table raise(KeyError('GLConfig does not contain key: %s' % repr(y))) @@ -425,7 +429,9 @@ class GLConfig(object): def getAuxDir(self): '''Return directory relative to --dir where auxiliary build tools are placed. Default comes from configure.ac or configure.in.''' - return(self.table['auxdir']) + if self.table['auxdir']: + return self.table['auxdir'] + return "build-aux" def setAuxDir(self, auxdir): '''Specify directory relative to --dir where auxiliary build tools are diff --git a/pygnulib/GLFileSystem.py b/pygnulib/GLFileSystem.py index 2a21eb1a5..6ccdc0b7e 100644 --- a/pygnulib/GLFileSystem.py +++ b/pygnulib/GLFileSystem.py @@ -300,7 +300,7 @@ class GLFileAssistant(object): constants.link_if_changed(lookedup, basepath) else: # if any of these conditions is not met try: # Try to move file - if exist(basepath): + if os.path.exists(basepath): os.remove(basepath) shutil.move(tmpfile, rewritten) except Exception as error: diff --git a/pygnulib/GLImport.py b/pygnulib/GLImport.py index c95236962..2859a2200 100644 --- a/pygnulib/GLImport.py +++ b/pygnulib/GLImport.py @@ -96,8 +96,10 @@ class GLImport(object): with codecs.open(path, 'rb', 'UTF-8') as file: data = file.read() pattern = compiler(r'^AC_CONFIG_AUX_DIR\((.*?)\)$', re.S | re.M) - result = cleaner(pattern.findall(data))[0] - self.cache.setAuxDir(joinpath(result, self.config['destdir'])) + match = pattern.findall(data) + if match: + result = cleaner(match)[0] + self.cache.setAuxDir(joinpath(result, self.config['destdir'])) pattern = compiler(r'A[CM]_PROG_LIBTOOL', re.S | re.M) guessed_libtool = bool(pattern.findall(data)) if self.config['auxdir'] == None: diff --git a/pygnulib/constants.py b/pygnulib/constants.py index d2995c7ab..defca17e8 100644 --- a/pygnulib/constants.py +++ b/pygnulib/constants.py @@ -391,13 +391,13 @@ def filter_filelist(separator, filelist, def substart(orig, repl, data): result = data if data.startswith(orig): - result = repl +data[len(orig):] + result = repl + data[len(orig):] return(result) def subend(orig, repl, data): result = data if data.endswith(orig): - result = repl +data[:len(repl)] + result = repl + data[:len(repl)] return(result) def nlconvert(text):