>From eb194fa7a5c8abc2e79ca608466b04dc89a7c67d Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Fri, 5 Aug 2022 15:15:16 +0200 Subject: [PATCH 03/12] gnulib-tool.py: Fix 'Undefined variable' errors. * pygnulib/constants.py: Import codecs. * pygnulib/GLConfig.py (GLConfig.setLibName): Fix local variable reference. * pygnulib/GLFileSystem.py (GLFileSystem.lookup, GLFileAssistant.update): Fix local variable references. * pygnulib/GLEmiter.py (GLEmiter.po_POTFILES_in): Fix reference. * pygnulib/GLTestDir.py (GLMegaTestDir.execute): Define missing local variables. --- ChangeLog | 10 ++++++++++ pygnulib/GLConfig.py | 2 +- pygnulib/GLEmiter.py | 2 +- pygnulib/GLFileSystem.py | 6 +++--- pygnulib/GLTestDir.py | 3 +++ pygnulib/constants.py | 1 + 6 files changed, 19 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 81871735d2..1d3630beea 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,15 @@ 2022-08-05 Bruno Haible + gnulib-tool.py: Fix 'Undefined variable' errors. + * pygnulib/constants.py: Import codecs. + * pygnulib/GLConfig.py (GLConfig.setLibName): Fix local variable + reference. + * pygnulib/GLFileSystem.py (GLFileSystem.lookup, + GLFileAssistant.update): Fix local variable references. + * pygnulib/GLEmiter.py (GLEmiter.po_POTFILES_in): Fix reference. + * pygnulib/GLTestDir.py (GLMegaTestDir.execute): Define missing local + variables. + gnulib-tool.py: Make option --version work. * pygnulib/constants.py (__copyright__): Bump copyright year. * pygnulib/GLInfo.py (GLInfo.authors): Add a comma after the diff --git a/pygnulib/GLConfig.py b/pygnulib/GLConfig.py index 039b4f012d..cda218e423 100644 --- a/pygnulib/GLConfig.py +++ b/pygnulib/GLConfig.py @@ -764,7 +764,7 @@ class GLConfig(object): self.table['libname'] = libname else: # if type of libname is not str raise TypeError('libname must be a string, not %s' - % type(module).__name__) + % type(libname).__name__) def resetLibName(self): '''Reset the library name to 'libgnu'.''' diff --git a/pygnulib/GLEmiter.py b/pygnulib/GLEmiter.py index b56e551f1d..b547fde7e7 100644 --- a/pygnulib/GLEmiter.py +++ b/pygnulib/GLEmiter.py @@ -450,7 +450,7 @@ USE_MSGCTXT = no\n""" emit = '' sourcebase = self.config['sourcebase'] sourcebase = '%s%s' % (self.sourcebase, os.path.sep) - files = [ substart('lib/', sourcebase, file) + files = [ constants.substart('lib/', sourcebase, file) for file in files ] files = [ file for file in files diff --git a/pygnulib/GLFileSystem.py b/pygnulib/GLFileSystem.py index 7bec0f9e6e..9e6161a24d 100644 --- a/pygnulib/GLFileSystem.py +++ b/pygnulib/GLFileSystem.py @@ -88,7 +88,7 @@ class GLFileSystem(object): GLConfig: localpath.''' if type(name) is not str: raise TypeError('name must be a string, not %s' - % type(module).__name__) + % type(name).__name__) localpath = self.config['localpath'] # Each element in localpath is a directory whose contents overrides # or amends the result of the lookup in the rest of localpath and @@ -322,9 +322,9 @@ class GLFileAssistant(object): raise GLError(17, original) else: # if self.config['dryrun'] if already_present: - print('Update file %s (backup in %s)' % (rewritten, backup)) + print('Update file %s (backup in %s)' % (rewritten, backupname)) else: # if not already_present - print('Replace file %s (backup in %s)' % (rewritten, backup)) + print('Replace file %s (backup in %s)' % (rewritten, backupname)) def add_or_update(self, already_present): '''GLFileAssistant.add_or_update(already_present) diff --git a/pygnulib/GLTestDir.py b/pygnulib/GLTestDir.py index 624a38317e..db74b9b4e3 100644 --- a/pygnulib/GLTestDir.py +++ b/pygnulib/GLTestDir.py @@ -906,6 +906,9 @@ class GLMegaTestDir(object): Create a mega scratch package with the given modules one by one and all together.''' + auxdir = self.config['auxdir'] + verbose = self.config['verbosity'] + megasubdirs = list() modules = [ self.modulesystem.find(m) for m in self.config['modules'] ] diff --git a/pygnulib/constants.py b/pygnulib/constants.py index ffee05846e..313aac94a1 100644 --- a/pygnulib/constants.py +++ b/pygnulib/constants.py @@ -25,6 +25,7 @@ import sys import platform import shutil import tempfile +import codecs import subprocess as sp import __main__ as interpreter -- 2.34.1