From 464e9ed364d9f87b7c7d43c54c99149d16b92b69 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sat, 20 Apr 2024 23:45:59 +0200 Subject: [PATCH] gnulib-tool.py: Fix a bug in removed / added files handling. * pygnulib/GLImport.py (GLImport.execute): When looking for files that are in both filetable['old'] and filetable['new'], consider only the first element of each tuple, not the entire tuple. --- ChangeLog | 7 +++++++ pygnulib/GLImport.py | 25 ++++++++++++++++--------- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index cd19c439df..da5c3833a2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2024-04-20 Bruno Haible + + gnulib-tool.py: Fix a bug in removed / added files handling. + * pygnulib/GLImport.py (GLImport.execute): When looking for files that + are in both filetable['old'] and filetable['new'], consider only the + first element of each tuple, not the entire tuple. + 2024-04-20 Bruno Haible gnulib-tool.py: Sort file lists case-sensitively. diff --git a/pygnulib/GLImport.py b/pygnulib/GLImport.py index e65e3e1235..59c7295cbc 100644 --- a/pygnulib/GLImport.py +++ b/pygnulib/GLImport.py @@ -1048,11 +1048,18 @@ AC_DEFUN([%s_FILE_LIST], [\n''' % macro_prefix # Create GLFileAssistant instance to process files. assistant = GLFileAssistant(self.config, transformers) + # Set of rewritten-file-names from filetable['old']. + old_rewritten_files = { pair[0] + for pair in filetable['old'] } + # Set of rewritten-file-names from filetable['new']. + new_rewritten_files = { pair[0] + for pair in filetable['new'] } + # Files which are in filetable['old'] and not in filetable['new']. # They will be removed and added to filetable['removed'] list. - pairs = [ f - for f in filetable['old'] - if f not in filetable['new'] ] + pairs = [ pair + for pair in filetable['old'] + if pair[0] not in new_rewritten_files ] pairs = sorted(set(pairs), key=lambda pair: pair[0]) files = sorted(set(pair[0] for pair in pairs)) for file in files: @@ -1074,9 +1081,9 @@ AC_DEFUN([%s_FILE_LIST], [\n''' % macro_prefix # Files which are in filetable['new'] and not in filetable['old']. # They will be added/updated and added to filetable['added'] list. already_present = False - pairs = [ f - for f in filetable['new'] - if f not in filetable['old'] ] + pairs = [ pair + for pair in filetable['new'] + if pair[0] not in old_rewritten_files ] pairs = sorted(set(pairs)) for pair in pairs: original = pair[1] @@ -1088,9 +1095,9 @@ AC_DEFUN([%s_FILE_LIST], [\n''' % macro_prefix # Files which are in filetable['new'] and in filetable['old']. # They will be added/updated and added to filetable['added'] list. already_present = True - pairs = [ f - for f in filetable['new'] - if f in filetable['old'] ] + pairs = [ pair + for pair in filetable['new'] + if pair[0] in old_rewritten_files ] pairs = sorted(set(pairs)) for pair in pairs: original = pair[1] -- 2.39.5