bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] gnulib-tool.py: Fix "Creating directory" output.


From: Bruno Haible
Subject: Re: [PATCH] gnulib-tool.py: Fix "Creating directory" output.
Date: Mon, 25 Mar 2024 13:20:47 +0100

Hi Collin,

> This patch fixes this test failure:
> 
> ./test-hello-c-gnulib-nonrecursive-1.out tmp1016386-out differ: byte 2612, 
> line 147
> --- ./test-hello-c-gnulib-nonrecursive-1.out  2024-03-24 03:30:48.391074752 
> -0700
> +++ tmp1016386-out    2024-03-24 18:33:30.855703830 -0700
> @@ -144,9 +144,9 @@
>    m4/wchar_t.m4
>    m4/wint_t.m4
>    m4/zzgnulib.m4
> -Creating directory ./lib
> -Creating directory ./gnulib-m4
> -Creating directory ./build-aux
> +Creating directory build-aux
> +Creating directory gnulib-m4
> +Creating directory lib

Nice! Thanks, applied.

>     for f in $files; do echo $f; done \
>       | sed -e "$sed_rewrite_new_files" \
>       | sed -n -e 's,^\(.*\)/[^/]*,\1,p' \
>       | LC_ALL=C sort -u
>   } > "$tmp"/dirs
> 
> To match this we can reorder gnulib-tool.py and use the dictionary
> trick I mentioned here to remove duplicates from a list while
> preserving order:
> 
> https://lists.gnu.org/archive/html/bug-gnulib/2024-03/msg00011.html

You don't need this trick here, since we sort this part of the list
anyway, for compatibility with gnulib-tool.sh.

This occurred also with the EXTRA_DIST augmentations:
In shell, the easiest way to remove duplicates from a list is to use
'LC_ALL=C sort -u', and accept the sorting as a side-effect. Removing
duplicates without sorting is a bit more complicated, so I didn't
bother doing that in the past.
In gnulib-tool.py, now, although removing duplicates without sorting
is easier, we cannot use it, since we need the sorting, for compatibility.

Applied with this tweak:


2024-03-25  Bruno Haible  <bruno@clisp.org>

        gnulib-tool.py: Simplify last change.
        * pygnulib/GLImport.py (GLImport.execute): Remove unnecessary list to
        set and set to list conversion.

diff --git a/pygnulib/GLImport.py b/pygnulib/GLImport.py
index e101af82f7..803f2d85dd 100644
--- a/pygnulib/GLImport.py
+++ b/pygnulib/GLImport.py
@@ -1081,8 +1081,8 @@ AC_DEFUN([%s_FILE_LIST], [\n''' % macro_prefix
         if gentests:
             dirs += [testsbase]
         dirs += [auxdir]
-        dirs += sorted(list(dict.fromkeys([ os.path.dirname(pair[0])
-                                            for pair in filetable['new'] ])))
+        dirs += sorted([ os.path.dirname(pair[0])
+                         for pair in filetable['new'] ])
         dirs = [ os.path.join(destdir, d)
                  for d in dirs ]
         for directory in dirs:






reply via email to

[Prev in Thread] Current Thread [Next in Thread]