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