>From af4eb877e856092bb2963661675f301806cf67c7 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Thu, 4 Aug 2022 18:35:49 +0200 Subject: [PATCH 6/9] gnulib-tool.py: Implement options --cache-modules, --no-cache-modules. * gnulib-tool.py (main): Accept options --cache-modules, --no-cache-modules. * pygnulib/GLConfig.py: Remove modcache property and constructor argument. * pygnulib/GLInfo.py (GLInfo.usage): Don't document these no-op options. --- ChangeLog | 7 +++++++ gnulib-tool.py | 11 +++++++++-- pygnulib/GLConfig.py | 34 +++------------------------------- pygnulib/GLEmiter.py | 2 -- pygnulib/GLInfo.py | 2 -- 5 files changed, 19 insertions(+), 37 deletions(-) diff --git a/ChangeLog b/ChangeLog index e54a572c09..14ecd4b31a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2022-08-04 Bruno Haible + gnulib-tool.py: Implement options --cache-modules, --no-cache-modules. + * gnulib-tool.py (main): Accept options --cache-modules, + --no-cache-modules. + * pygnulib/GLConfig.py: Remove modcache property and constructor + argument. + * pygnulib/GLInfo.py (GLInfo.usage): Don't document these no-op options. + gnulib-tool.py: Use mainstream/GNU coding style. * gnulib-tool.py: Break lines before the % operator, not after. * pygnulib/*.py: Likewise. Avoid line breaks when the resulting lines diff --git a/gnulib-tool.py b/gnulib-tool.py index 4f5494655d..6ca3647604 100755 --- a/gnulib-tool.py +++ b/gnulib-tool.py @@ -68,7 +68,6 @@ def main(): mode = None destdir = None localpath = None - modcache = None verbose = None auxdir = None modules = None @@ -233,6 +232,15 @@ def main(): dest='localpath', default=None, nargs=1) + # cache-modules: a no-op for backward compatibility + parser.add_argument('--cache-modules', + dest='cache_modules', + default=None, + action='store_true') + parser.add_argument('--no-cache-modules', + dest='cache_modules', + default=None, + action='store_false') # verbose parser.add_argument('--verbose', default=0, @@ -648,7 +656,6 @@ def main(): vc_files=vc_files, symbolic=symlink, lsymbolic=lsymlink, - modcache=modcache, single_configure=single_configure, verbose=verbose, dryrun=dryrun, diff --git a/pygnulib/GLConfig.py b/pygnulib/GLConfig.py index a9c2319e2c..4a38473efb 100644 --- a/pygnulib/GLConfig.py +++ b/pygnulib/GLConfig.py @@ -62,7 +62,7 @@ class GLConfig(object): incl_test_categories=None, excl_test_categories=None, libname=None, lgpl=None, makefile=None, libtool=None, conddeps=None, macro_prefix=None, podomain=None, witness_c_macro=None, vc_files=None, symbolic=None, - lsymbolic=None, modcache=None, configure_ac=None, ac_version=None, + lsymbolic=None, configure_ac=None, ac_version=None, libtests=None, single_configure=None, verbose=None, dryrun=None, errors=None): '''GLConfig.__init__(arguments) -> GLConfig @@ -212,17 +212,6 @@ class GLConfig(object): else: # if type(lsymbolic) is not bool raise TypeError('lsymbolic must be a bool, not %s' % type(lsymbolic).__name__) - # modcache - self.resetModuleCaching() - if modcache != None: - if type(modcache) is bool: - if not modcache: - self.disableModuleCaching() - else: # if modcache - self.enableModuleCaching() - else: # if type(modcache) is not bool - raise TypeError('modcache must be a bool, not %s' - % type(modcache).__name__) # configure_ac self.resetAutoconfFile() if configure_ac != None: @@ -358,8 +347,8 @@ class GLConfig(object): return True elif key in ['modules', 'avoids', 'tests', 'incl_test_categories', 'excl_test_categories']: return list() - elif key in ['libtool', 'lgpl', 'conddeps', 'modcache', 'symbolic', - 'lsymbolic', 'libtests', 'dryrun']: + elif key in ['libtool', 'lgpl', 'conddeps', 'symbolic', 'lsymbolic', + 'libtests', 'dryrun']: return False if key == 'vc_files': return None @@ -976,23 +965,6 @@ class GLConfig(object): '''Reset update of the version control files and set it to None.''' self.table['vc_files'] = None - # Define modcache methods. - def checkModuleCaching(self): - '''Get status of module caching optimization.''' - return self.table['modcache'] - - def enableModuleCaching(self): - '''Enable module caching optimization.''' - self.table['modcache'] = True - - def disableModuleCaching(self): - '''Disable module caching optimization.''' - self.table['modcache'] = False - - def resetModuleCaching(self): - '''Reset module caching optimization.''' - self.table['modcache'] = False - # Define configure_ac methods. def getAutoconfFile(self): '''Return path of autoconf file relative to destdir.''' diff --git a/pygnulib/GLEmiter.py b/pygnulib/GLEmiter.py index 223e1ee553..4e4ce4a053 100644 --- a/pygnulib/GLEmiter.py +++ b/pygnulib/GLEmiter.py @@ -636,7 +636,6 @@ AC_DEFUN([%V1%_LIBSOURCES], [ % type(for_test).__name__) emit = '' sourcebase = self.config['sourcebase'] - modcache = self.config['modcache'] libname = self.config['libname'] pobase = self.config['pobase'] auxdir = self.config['auxdir'] @@ -908,7 +907,6 @@ AC_DEFUN([%V1%_LIBSOURCES], [ emit = '' auxdir = self.config['auxdir'] sourcebase = self.config['sourcebase'] - modcache = self.config['modcache'] libname = self.config['libname'] m4base = self.config['m4base'] pobase = self.config['pobase'] diff --git a/pygnulib/GLInfo.py b/pygnulib/GLInfo.py index 720e357c90..34b38db7eb 100644 --- a/pygnulib/GLInfo.py +++ b/pygnulib/GLInfo.py @@ -184,8 +184,6 @@ General options: directory. --local-dir=DIRECTORY Specify a local override directory where to look up files before looking in gnulib's directory. - --cache-modules Enable module caching optimization. - --no-cache-modules Disable module caching optimization. --verbose Increase verbosity. May be repeated. --quiet Decrease verbosity. May be repeated. -- 2.34.1