Hi Bruno, On 4/16/24 8:09 AM, Bruno Haible wrote: > I'm talking about this piece of code: > > filetable = [] > for src in filelist: > dest = self.rewrite_files([src])[-1] > filetable.append(tuple([dest, src])) > > which can be written as > > filetable = [ tuple([self.rewrite_filename(src), src]) > for src in filelist ]
I'm taking a look at this again and I think it would make sense to move these 'rewrite_filename' functions to GLConfig since they only use the directory names stored there. Right now we have the following: 1. GLImport.rewrite_old_files() # Uses self.cache 2. GLImport.rewrite_new_files() # Uses self.config 3. GLTestDir.rewrite_files() # Uses self.config, TestDir has no cache I'm thinking of making this function accept a single filename instead of a list, and then moving it to GLConfig. Omitting the tuple stuff for clarity, but this is how the new/old filename distinction would be handled: # Equals current GLImport.rewrite_old_files() [ self.cache.rewrite_filename(src) for src in filelist ] # Equals current GLImport.rewrite_new_files() [ self.config.rewrite_filename(src) for src in filelist ] What do you think about this change? Also, there is a similar section of code to this new function in main.py line 1313 under "mode == 'copy-file'", but it is missing the 'tests=lib/' replacement. Would there be a way to simplify that too? The use of 'tests=lib/' is escaping my mind at the moment... Collin