[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: gnulib-tool.py: Remove a redundant function.
From: |
Bruno Haible |
Subject: |
Re: gnulib-tool.py: Remove a redundant function. |
Date: |
Mon, 15 Apr 2024 13:47:00 +0200 |
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-15 06:35:01.941511954 +0200
@@ -1,7 +1,7 @@
- def rewrite_old_files(self, files: list[str]) -> list[str]:
- '''Replace auxdir, docbase, sourcebase, m4base and testsbase from
default
- to their version from cached config.'''
+ def rewrite_new_files(self, files: list[str]) -> list[str]:
+ '''Replace auxdir, docbase, sourcebase, m4base and testsbase from
+ default to their version from config.'''
if type(files) is not list:
raise TypeError('files argument must has list type, not %s'
% type(files).__name__)
@@ -9,13 +9,11 @@
if type(file) is not str:
raise TypeError('each file must be a string instance')
files = sorted(set(files))
- files = [ '%s%s' % (file, os.path.sep)
- for file in files ]
- auxdir = self.cache['auxdir']
- docbase = self.cache['docbase']
- sourcebase = self.cache['sourcebase']
- m4base = self.cache['m4base']
- testsbase = self.cache['testsbase']
+ auxdir = self.config['auxdir']
+ docbase = self.config['docbase']
+ sourcebase = self.config['sourcebase']
+ m4base = self.config['m4base']
+ testsbase = self.config['testsbase']
result = []
for file in files:
if file.startswith('build-aux/'):
> Therefore, we can remove GLImport.rewrite_old_files() and rename
> GLImport.rewrite_new_files() to GLImport.rewrite_files().
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 files are not removed, for m4base the list
of modules gets reset to empty.)
Bruno
- gnulib-tool.py: Remove a redundant function., Collin Funk, 2024/04/14
- 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 <=