]> Savannah Git Hosting - gnulib.git/commitdiff
gnulib-tool.py: Fix mistake in previous commit.
authorCollin Funk <collin.funk1@gmail.com>
Wed, 1 May 2024 09:21:43 +0000 (02:21 -0700)
committerCollin Funk <collin.funk1@gmail.com>
Wed, 1 May 2024 09:21:43 +0000 (02:21 -0700)
* pygnulib/GLModuleSystem.py (GLModuleSystem.exists)
(GLModuleSystem.find): Rename 'module' argument to 'module_name' so it
is clear they are not a GLModule object. Treat them as such.

ChangeLog
pygnulib/GLModuleSystem.py

index 917761a7d2128e7d247eab2dc7f6975268e65830..fee17c01ce811a2ed9419cb3bdf378df2db970fe 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2024-05-01  Collin Funk  <collin.funk1@gmail.com>
+
+       gnulib-tool.py: Fix mistake in previous commit.
+       * pygnulib/GLModuleSystem.py (GLModuleSystem.exists)
+       (GLModuleSystem.find): Rename 'module' argument to 'module_name' so it
+       is clear they are not a GLModule object. Treat them as such.
+
 2024-05-01  Collin Funk  <collin.funk1@gmail.com>
 
        gnulib-tool.py: Use the GLModule's name variable directly.
index 2bfd5b252f751fbab8d26c49613a0897ea5cd7dd..2cb5d1d468259a9a658da5bc93c026ba28e61b58 100644 (file)
@@ -65,43 +65,43 @@ class GLModuleSystem:
         result = '<pygnulib.GLModuleSystem %s>' % hex(id(self))
         return result
 
-    def exists(self, module: str) -> bool:
+    def exists(self, module_name: str) -> bool:
         '''Check whether the given module exists.
         GLConfig: localpath.'''
-        if type(module) is not str:
-            raise TypeError('module must be a string, not %s'
-                            % type(module).__name__)
+        if type(module_name) is not str:
+            raise TypeError('module_name must be a string, not %s'
+                            % type(module_name).__name__)
         localpath = self.config['localpath']
         result = False
         badnames = ['ChangeLog', 'COPYING', 'README', 'TEMPLATE',
                     'TEMPLATE-EXTENDED', 'TEMPLATE-TESTS']
-        if module not in badnames:
-            result = os.path.isfile(joinpath(DIRS['modules'], module))
+        if module_name not in badnames:
+            result = os.path.isfile(joinpath(DIRS['modules'], module_name))
             if not result:
                 for localdir in localpath:
                     if (os.path.isdir(joinpath(localdir, 'modules'))
-                            and os.path.isfile(joinpath(localdir, 'modules', module))):
+                            and os.path.isfile(joinpath(localdir, 'modules', module_name))):
                         result = True
                         break
         return result
 
-    def find(self, module: str) -> GLModule | None:
+    def find(self, module_name: str) -> GLModule | None:
         '''Return the GLModule object given the module name,
         or None if the module description file with that name does not exist.
-        - module, The name of the module.'''
-        if type(module) is not str:
-            raise TypeError('module must be a string, not %s'
-                            % type(module).__name__)
-        if self.exists(module):
-            path, istemp = self.filesystem.lookup(joinpath('modules', module))
-            result = GLModule(self.config, module, path, istemp)
+        - module_name, The name of the module.'''
+        if type(module_name) is not str:
+            raise TypeError('module_name must be a string, not %s'
+                            % type(module_name).__name__)
+        if self.exists(module_name):
+            path, istemp = self.filesystem.lookup(joinpath('modules', module_name))
+            result = GLModule(self.config, module_name, path, istemp)
             return result
         else:  # if not self.exists(module)
             if self.config['errors']:
-                raise GLError(3, module)
+                raise GLError(3, module_name)
             else:  # if not self.config['errors']
                 sys.stderr.write('gnulib-tool: warning: ')
-                sys.stderr.write("module %s doesn't exist\n" % module.name)
+                sys.stderr.write("module %s doesn't exist\n" % module_name)
 
     def file_is_module(self, filename: str) -> bool:
         '''Given the name of a file in the modules/ directory, return true