On Sat, Feb 13, 2021 at 6:18 PM Felix Bier <[email protected]> wrote: > > This commit enables recursive globbing in clear_path, allowing the > usage of '**' to match an arbitrary number of sub-directories. > > Before this commit, clear_path used only non-recursive globbing. This > allowed to use '*' to expand names within one directory, e.g. '/a/*/c' > can expand to '/a/b/c', but not '/a/b/b/c'. With this commit, '/a/**/c' > can be used to expand to '/a/b/c', '/a/b/b/c', '/a/b/b/b/c' etc. > > This is motivated by wanting to recursively delete all occurences of a > filename with the 'stage4/rm' entry of a spec file. The '/rm' entries > are processed with 'clear_path' in the existing code. > > Additionally, 'glob.glob' is replaced with 'glob.iglob', > which returns the same files as 'glob.glob', but as an iterator > instead of as a list (so it no longer necessary to hold > all matches in memory at once). > > Recursive globbing has been added in Python 3.5. > > References: > https://docs.python.org/3/library/glob.html#glob.glob > https://docs.python.org/3/library/glob.html#glob.iglob
Nice, thank you. Committed!
