On 5/4/24 3:34 AM, Bruno Haible wrote:
> Yes. We cannot change the past git log, but this is one of the situations
> where changing a ChangeLog entry is adequate. Other such situations are
> obvious typos and forgotten changes.

I've pushed the attached patch adding the date to the ChangeLog entry.

>>> In this case, maybe some Python style checker would have produced a
>>> warning, right? Would it be possible to add a Makefile rule that checks
>>> for the absense of such warnings, and then use this Makefile rule in the
>>> continuous integration that runs at least once a week?
>>
>> Hmm, I like that idea. I would have to find what tool works best for
>> that.
> 
> Yes, please.

Right now I am leaning towards mypy. It seems to be the best at
detecting errors/potential errors.

For CI, I am thinking it is best to ignore the typing warnings for the
time being. Since gnulib-tool.py needs a bit more refactoring for that
to be helpful. It was written before typing was a thing. :)

mypy has the following options:

     mypy --disable-error-code NAME
     mypy --enable-error-code NAME

but there is a long list of error names and I'm not sure how
compatible they are between versions.

I'm removing the 'lines_to_multiline' import from GLImport.py. We
could have a few checks for guaranteed runtime failures like this:

      $ mypy GLImport.py | grep 'name-defined'
      GLImport.py:722: error: Name "lines_to_multiline" is not defined  
[name-defined]
      GLImport.py:736: error: Name "lines_to_multiline" is not defined  
[name-defined]
      GLImport.py:1143: error: Name "lines_to_multiline" is not defined  
[name-defined]
      GLImport.py:1326: error: Name "lines_to_multiline" is not defined  
[name-defined]
      GLImport.py:1327: error: Name "lines_to_multiline" is not defined  
[name-defined]
      GLImport.py:1328: error: Name "lines_to_multiline" is not defined  
[name-defined]

I'm not too familiar with the GitLab CI stuff. Would a Makefile in
gnulib/pygnulib with some checks work? Or did you have a different idea?

I think mypy should be packed in Debian and Fedora as 'python3-mypy'.
Another method that works for Python software is pipx [1]:

    $ pipx install mypy
    $ readlink $HOME/.local/bin/mypy
    /home/collin/.local/share/pipx/venvs/mypy/bin/mypy

Sometimes it helps for distributions with old packages. It uses a
virtual environment so you don't have to worry about breaking things
too.

[1] https://pipx.pypa.io/stable/

Collin
From 284c0ad51e1caba277616c76c6cd14774d92e19c Mon Sep 17 00:00:00 2001
From: Collin Funk <collin.fu...@gmail.com>
Date: Sat, 4 May 2024 05:17:45 -0700
Subject: [PATCH] Fix ChangeLog entry for previous commit.

---
 ChangeLog | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 96b29b7fc4..6b56b35d8e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,6 @@
 2024-05-03  Collin Funk  <collin.fu...@gmail.com>
 
-	gnulib-tool.py: Fix an undefined function name.
+	gnulib-tool.py: Fix an undefined function name (regression 2024-05-02).
 	* pygnulib/main.py (main_with_exception_handling): Use the tempfile
 	module prefix when calling mkdtemp(). Use the 'glpy' prefix for the
 	temporary directory that exists for the entirety of the program.
-- 
2.44.0

Reply via email to