[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gnulib-tool.py: Remove a redundant function.
From: |
Collin Funk |
Subject: |
gnulib-tool.py: Remove a redundant function. |
Date: |
Sun, 14 Apr 2024 18:23:48 -0700 |
User-agent: |
Mozilla Thunderbird |
The GLImport class has two functions that are the same,
GLImport.rewrite_old_files() and GLImport.rewrite_new_files().
The GLImport.rewrite_old_files() function does this extra step before
processing the list:
files = [ '%s%s' % (file, os.path.sep)
for file in files ]
But before appending it to the resulting list os.path.normpath() is
used.
Since the following is true:
os.path.normpath('abc') == 'abc'
os.path.normpath('abc/') == 'abc'
both of these functions are the same.
Therefore, we can remove GLImport.rewrite_old_files() and rename
GLImport.rewrite_new_files() to GLImport.rewrite_files().
Also, I noticed we have:
for src in old_files:
dest = self.rewrite_files([src])[-1]
old_table.append(tuple([dest, src]))
This is looping over a list, creating a new list with one item,
calling GLImport.rewrite_files(), which then calls sorted(set(...))
twice, and then appending the result to a list.
We should be able to create a new list from that function and zip()
the two together. I'll submit another patch for that since it requires
some sorting changes.
Collin
0001-gnulib-tool.py-Remove-a-redundant-function.patch
Description: Text Data
- gnulib-tool.py: Remove a redundant function.,
Collin Funk <=
- Re: gnulib-tool.py: Remove a redundant function., Collin Funk, 2024/04/14
- Re: gnulib-tool.py: Remove a redundant function., Bruno Haible, 2024/04/15
- Re: gnulib-tool.py: Remove a redundant function., Collin Funk, 2024/04/15
- Re: gnulib-tool.py: Remove a redundant function., Bruno Haible, 2024/04/16
- Re: gnulib-tool.py: Remove a redundant function., Collin Funk, 2024/04/16
- Refactoring rewrite_filename functions, Collin Funk, 2024/04/16
- Re: Refactoring rewrite_filename functions, Bruno Haible, 2024/04/16
- Re: Refactoring rewrite_filename functions, Collin Funk, 2024/04/16
- Re: Refactoring rewrite_filename functions, Bruno Haible, 2024/04/17
Re: gnulib-tool.py: Remove a redundant function., Bruno Haible, 2024/04/15