Re: [PATCH] gnulib-tool.py: Simplify creation of module shell ids.

2024-05-29 Thread Bruno Haible
Collin Funk wrote: > I've committed this patch adding the ASCII flag. Thanks.

Re: [PATCH] gnulib-tool.py: Simplify creation of module shell ids.

2024-05-29 Thread Collin Funk
Collin Funk writes: > In the documentation for \w it states [2]: > > Matches [a-zA-Z0-9_] if the ASCII flag is used. I've committed this patch adding the ASCII flag. I noticed some other duplicated regular expressions that could probably be simplified. I'll take a look at seeing if re.ASCII

Re: [PATCH] gnulib-tool.py: Simplify creation of module shell ids.

2024-05-29 Thread Collin Funk
Hi Bruno, Bruno Haible writes: > But that's not the same thing: The previous code made sure that > module names with non-ASCII characters use the MD5 hash code. > The new code does not: > re.match(re.compile(r'^[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_]*$'),'abcäöü') >

Re: [PATCH] gnulib-tool.py: Simplify creation of module shell ids.

2024-05-29 Thread Bruno Haible
Hi Collin, > -# List of characters allowed in shell identifiers. > -shell_id_chars: ClassVar[str] = > 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_' > +# Regular expression matching module names that can be used as shell ids. > +shell_id_pattern: ClassVar[re.Pat

Re: [PATCH] gnulib-tool.py: Simplify creation of module shell ids.

2024-05-28 Thread Collin Funk
Collin Funk writes: > +def getShellId(self) -> str: > +if re.match(self.shell_id_pattern, self.name): > +return self.name > +return > hashlib.md5(f'{self.name}\n'.encode(ENCS['default'])).hexdigest() > + Oops, I forgot to write a docstring... I've pushed this pat

[PATCH] gnulib-tool.py: Simplify creation of module shell ids.

2024-05-28 Thread Collin Funk
* pygnulib/GLModuleSystem.py (GLModule.shell_id_chars): Remove class variable. (GLModule.shell_id_pattern): New class variable. (GLModule.getShellId): New function. (GLModule.getShellFunc, GLModule.getShellVar) (GLModule.getConditionalName): Use it. --- ChangeLog | 10 py