Re: Simplified Python caching

2024-04-15 Thread Collin Funk
Hi Bruno, On 4/15/24 11:24 AM, Bruno Haible wrote: > It's better to not do it, and keep the code as-is. That is fine with me. Though I will offer my perspective on some of your reasonings. Similar considerations to a previous thread [1]. > * As I already mentioned, it's good to keep the code u

Re: Simplified Python caching

2024-04-15 Thread Bruno Haible
Hi Collin, > I was looking at the documentation for the Python standard library > yesterday and discovered the 'lru_cache()' function [1]. ... > >if 'makefile-unconditional' not in self.cache: ># do work and then save it >self.cache['makefile-unconditional'] = resu

Simplified Python caching

2024-04-15 Thread Collin Funk
I was looking at the documentation for the Python standard library yesterday and discovered the 'lru_cache()' function [1]. Python 3.9 defines 'cache()' to be 'lru_cache(maxsize=None)' [2]. This is a simple cache doesn't require a list and keeping track of size for LRU replacements [3]. I was curi

Re: gnulib-tool.py: Optimize directory creation.

2024-04-15 Thread Bruno Haible
Hi Collin, > This patch handles the directory creation upfront instead of checking > for every single file, as you mentioned earlier [1]. Thanks! This looks good. Applied. Bruno

gnulib-tool.py: Optimize directory creation.

2024-04-15 Thread Collin Funk
Hi Bruno, Separating this from the other thread so it is easier to follow. This patch handles the directory creation upfront instead of checking for every single file, as you mentioned earlier [1]. The previously unused variable was slightly incorrect. We have to join the directory name with sel

Re: [PATCH] gitlog-to-changelog: Make output reproducible.

2024-04-15 Thread Simon Josefsson via Gnulib discussion list
Bruno Haible writes: > I don't agree with this patch. It misrepresents the dates on which people > have checked in their commits. Paul Eggert writes: > Emacs has had the tradition of using UTC for ChangeLog dates, so > please support that as well, as an option. This Emacs tradition dates > bac

Re: gnulib-tool.py: Remove a redundant function.

2024-04-15 Thread Collin Funk
Hi Bruno, On 4/15/24 7:58 AM, Bruno Haible wrote: > Patch 0002 is not applicable because it relies on 0001, which was not good. Yes, I need to rewrite it. But I think the idea of the patch is still correct. Since it doesn't make sense to accept a list and then only use it with one element lists.

Re: gnulib-tool.py: Remove a redundant function.

2024-04-15 Thread Bruno Haible
Hi Collin, > Patch 0002 does this. GLTestDir also has this rewrite_files() function > so I did the same there. Maybe it is worth making that a helper > function or using a base class in the future. > > Also, the set() and list() calls around zip(...) are important since > zip() returns an iterato

Re: gnulib-tool.py: Remove a redundant function.

2024-04-15 Thread Collin Funk
Hi Bruno, On 4/15/24 4:47 AM, Bruno Haible wrote: > No. I'm adding 3 unit tests that prove that the patch is wrong, > one for each of docbase, sourcebase, testsbase. (For auxdir and m4base > gnulib-tool.{sh,py} does not support changing the value while preserving > the rest: For auxdir the old fil

Re: gnulib-tool.py: Remove a redundant function.

2024-04-15 Thread Bruno Haible
Collin Funk wrote: > The GLImport class has two functions that are the same, > GLImport.rewrite_old_files() and GLImport.rewrite_new_files(). No. When I copy these functions into separate text files and use 'diff' on them: $ diff -u 1 2 --- 1 2024-04-15 06:34:45.441369330 +0200 +++ 2 2024-04-