From: "Matt Turner" <mattst88@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/catalyst:master commit in: catalyst/
Date: Sat, 20 Feb 2021 21:27:50 +0000 (UTC) [thread overview]
Message-ID: <1613856449.4fd2ac23250ab2ac1f6a506ee433f466a4f9e026.mattst88@gentoo> (raw)
Message-ID: <20210220212750.-Rqld2luYEtNTPyJNWP2P6R6EBRLwjRfBMjIFhjtJAI@z> (raw)
commit: 4fd2ac23250ab2ac1f6a506ee433f466a4f9e026
Author: Felix Bier <Felix.Bier <AT> rohde-schwarz <DOT> com>
AuthorDate: Sat Feb 13 23:18:17 2021 +0000
Commit: Matt Turner <mattst88 <AT> gentoo <DOT> org>
CommitDate: Sat Feb 20 21:27:29 2021 +0000
URL: https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=4fd2ac23
Enable recursive globbing for clear_path
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
Signed-off-by: Felix Bier <felix.bier <AT> rohde-schwarz.com>
Signed-off-by: Matt Turner <mattst88 <AT> gentoo.org>
catalyst/fileops.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/catalyst/fileops.py b/catalyst/fileops.py
index 5c6f5cd8..59525420 100644
--- a/catalyst/fileops.py
+++ b/catalyst/fileops.py
@@ -99,7 +99,7 @@ def clear_dir(target, mode=0o755, remove=False,
def clear_path(target_path):
"""Nuke |target_path| regardless of it being a dir, file or glob."""
- targets = glob.glob(target_path)
+ targets = glob.iglob(target_path, recursive=True)
for path in targets:
clear_dir(path, remove=True)
next reply other threads:[~2021-02-20 21:27 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-10 0:48 Matt Turner [this message]
2021-02-20 21:27 ` [gentoo-commits] proj/catalyst:master commit in: catalyst/ Matt Turner
-- strict thread matches above, loose matches on Subject: below --
2022-11-20 0:21 [gentoo-commits] proj/catalyst:wip/mattst88 " Matt Turner
2021-06-11 3:30 [gentoo-commits] proj/catalyst:master " Matt Turner
2021-06-10 0:48 ` [gentoo-commits] proj/catalyst:wip/mattst88 " Matt Turner
2021-02-20 21:27 [gentoo-commits] proj/catalyst:master " Matt Turner
2021-06-10 0:48 ` [gentoo-commits] proj/catalyst:wip/mattst88 " Matt Turner
2021-01-29 23:50 Matt Turner
2021-01-29 23:50 Matt Turner
2020-11-14 16:37 [gentoo-commits] proj/catalyst:master " Matt Turner
2020-12-19 19:56 ` [gentoo-commits] proj/catalyst:wip/mattst88 " Matt Turner
2020-10-30 22:41 [gentoo-commits] proj/catalyst:master " Matt Turner
2020-12-19 19:56 ` [gentoo-commits] proj/catalyst:wip/mattst88 " Matt Turner
2020-05-21 20:26 [gentoo-commits] proj/catalyst:master " Matt Turner
2020-05-27 6:20 ` [gentoo-commits] proj/catalyst:wip/mattst88 " Matt Turner
2020-05-21 20:25 [gentoo-commits] proj/catalyst:master " Matt Turner
2020-05-20 1:52 ` [gentoo-commits] proj/catalyst:wip/mattst88 " Matt Turner
2020-05-21 20:25 [gentoo-commits] proj/catalyst:master " Matt Turner
2020-05-20 1:52 ` [gentoo-commits] proj/catalyst:wip/mattst88 " Matt Turner
2020-05-21 20:25 [gentoo-commits] proj/catalyst:master " Matt Turner
2020-05-20 1:52 ` [gentoo-commits] proj/catalyst:wip/mattst88 " Matt Turner
2020-05-20 3:39 [gentoo-commits] proj/catalyst:pending/mattst88 " Matt Turner
2020-05-20 3:39 ` [gentoo-commits] proj/catalyst:wip/mattst88 " Matt Turner
2020-05-20 3:39 [gentoo-commits] proj/catalyst:pending/mattst88 " Matt Turner
2020-05-20 1:52 ` [gentoo-commits] proj/catalyst:wip/mattst88 " Matt Turner
2020-05-20 2:33 Matt Turner
2020-05-20 2:29 Matt Turner
2020-05-20 1:52 Matt Turner
2020-05-20 1:52 Matt Turner
2020-05-20 1:52 Matt Turner
2020-05-20 1:52 Matt Turner
2020-05-20 1:52 Matt Turner
2020-05-20 0:26 Matt Turner
2020-05-20 0:26 Matt Turner
2020-05-20 0:26 Matt Turner
2020-05-20 0:26 Matt Turner
2020-05-20 0:26 Matt Turner
2020-05-20 0:26 Matt Turner
2020-05-20 0:26 Matt Turner
2020-05-19 23:45 Matt Turner
2020-05-19 23:45 Matt Turner
2020-05-19 23:39 Matt Turner
2020-05-19 23:39 Matt Turner
2020-05-19 23:30 Matt Turner
2020-05-19 23:30 Matt Turner
2020-05-19 23:04 Matt Turner
2020-05-19 23:04 Matt Turner
2020-05-19 22:55 Matt Turner
2020-05-19 22:55 Matt Turner
2020-05-19 22:55 Matt Turner
2020-05-19 22:55 Matt Turner
2020-05-19 22:55 Matt Turner
2020-05-19 22:55 Matt Turner
2020-05-19 22:55 Matt Turner
2020-05-19 22:55 Matt Turner
2020-05-19 22:55 Matt Turner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1613856449.4fd2ac23250ab2ac1f6a506ee433f466a4f9e026.mattst88@gentoo \
--to=mattst88@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox