Hi Bruno,

Am Fr., 16. Aug. 2024 um 18:03 Uhr schrieb Bruno Haible <br...@clisp.org>:

> Hi Marc,
>
> Please keep the mailing list in CC.
>

This was due to my inability to use my email program properly.


> > > Does it still do so if you remove the 'valgrind-tests' modules from the
> > > list?
> > >
> >
> > It does not.
>
> OK, then the problem is that gnulib-tool does not know that
> 'valgrind-tests'
> is special. Fixed like this.
>
> We could have noticed the problem before, by looking at the gnulib-tool
> results in liboath/ and libpskc/ of oath-toolkit.
>

Thank you for the patch.  I can confirm that the problem has been fixed
when using GNULIB_TOOL_IMPL=py and is still present when using
GNULIB_TOOL_IMPL=sh.

Best wishes,

Marc


> 2024-08-16  Bruno Haible  <br...@clisp.org>
>
>         gnulib-tool.py: Don't treat 'valgrind-tests' as a tests module.
>         Reported by Marc Nieper-Wißkirchen <marc.nieper+...@gmail.com> in
>         <
> https://lists.gnu.org/archive/html/bug-gnulib/2024-08/msg00093.html>.
>         * pygnulib/GLModuleSystem.py (_isTestsModuleName): New function.
>         (GLModuleSystem.list, GLModule.isNonTests,
> GLModule.getApplicability,
>         GLModule.getDependencies,
> GLModule.getAutomakeSnippet_Unconditional,
>         GLModule.getLicense): Use it.
>
> diff --git a/pygnulib/GLModuleSystem.py b/pygnulib/GLModuleSystem.py
> index 09afcf6883..1f758fb0e5 100644
> --- a/pygnulib/GLModuleSystem.py
> +++ b/pygnulib/GLModuleSystem.py
> @@ -55,6 +55,10 @@ def _extract_lib_SOURCES(snippet: str) -> list[str]:
>               for line in lines
>               for file_name in line.split() ]
>
> +def _isTestsModuleName(name: str) -> bool:
> +    '''Determine whether a module is a tests module, given its name.'''
> +    return name.endswith('-tests') and name != 'valgrind-tests'
> +
>
>
>  
> #===============================================================================
>  # Define GLModuleSystem class
> @@ -162,7 +166,7 @@ def list(self) -> list[str]:
>          # Filter out undesired file names.
>          listing = [ line
>                      for line in listing
> -                    if self.file_is_module(line) and not
> line.endswith('-tests') ]
> +                    if self.file_is_module(line) and not
> _isTestsModuleName(line) ]
>          modules = sorted(set(listing))
>          return modules
>
> @@ -307,7 +311,7 @@ def isTests(self) -> bool:
>
>      def isNonTests(self) -> bool:
>          '''Check whether module is not a *-tests module.'''
> -        result = not self.name.endswith('-tests')
> +        result = not _isTestsModuleName(self.name)
>          return result
>
>      def getTestsName(self) -> str:
> @@ -426,7 +430,7 @@ def getApplicability(self) -> str:
>              result = result.strip()
>              if not result:
>                  # The default is 'main' or 'tests', depending on the
> module's name.
> -                if self.name.endswith('-tests'):
> +                if _isTestsModuleName(self.name):
>                      result = 'tests'
>                  else:
>                      result = 'main'
> @@ -467,7 +471,7 @@ def getDependencies(self) -> str:
>          if 'dependencies' not in self.cache:
>              result = ''
>              # ${module}-tests implicitly depends on ${module}, if that
> module exists.
> -            if self.name.endswith('-tests'):
> +            if _isTestsModuleName(self.name):
>                  main_module = subend('-tests', '', self.name)
>                  if self.modulesystem.exists(main_module):
>                      result += '%s\n' % main_module
> @@ -657,7 +661,7 @@ def getAutomakeSnippet_Unconditional(self) -> str:
>          auxdir = self.config['auxdir']
>          result = ''
>          if 'makefile-unconditional' not in self.cache:
> -            if self.name.endswith('-tests'):
> +            if _isTestsModuleName(self.name):
>                  # *-tests module live in tests/, not lib/.
>                  # Synthesize an EXTRA_DIST augmentation.
>                  files = self.getFiles()
> @@ -734,7 +738,7 @@ def getLicense(self) -> str:
>          if 'license' not in self.cache:
>              license = self.getLicense_Raw().strip()
>              # Warn if the License field is missing.
> -            if not self.name.endswith('-tests'):
> +            if not _isTestsModuleName(self.name):
>                  if not license:
>                      if self.config['errors']:
>                          raise GLError(18, self.name)
>
>
>
>

Reply via email to