public inbox for cygwin-apps-cvs@sourceware.org
help / color / mirror / Atom feed
From: Jon TURNEY <jturney@sourceware.org>
To: cygwin-apps-cvs@sourceware.org
Subject: [calm - Cygwin server-side packaging maintenance script] branch master, updated. 20220627-4-g879bfc5
Date: Sat,  2 Jul 2022 21:07:09 +0000 (GMT)	[thread overview]
Message-ID: <20220702210709.C61EE3858C53@sourceware.org> (raw)




https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/calm.git;h=879bfc586924cdaf42fc425fb71e7e145b8752a0

commit 879bfc586924cdaf42fc425fb71e7e145b8752a0
Author: Jon Turney <jon.turney@dronecode.org.uk>
Date:   Sat Jul 2 22:03:26 2022 +0100

    Ignore flake8-bugbear B023
    
    I seem to like writing code which I think legitimately use the construct
    this warns about.
    
    Drop ignoring B020, since false positives are fixed.

https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/calm.git;h=130b929a2c7d4fbc28bedcbdbac7214acdacf328

commit 130b929a2c7d4fbc28bedcbdbac7214acdacf328
Author: Jon Turney <jon.turney@dronecode.org.uk>
Date:   Sat Jul 2 20:29:08 2022 +0100

    Only remove empty subdirectories below a certain depth
    
    'cygport upload/stage' assumes the existence of the '<arch>/release'
    directories, so don't remove those, even if empty.


Diff:
---
 .flake8       | 2 +-
 calm/utils.py | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/.flake8 b/.flake8
index 48e7f81..7c03237 100644
--- a/.flake8
+++ b/.flake8
@@ -1,5 +1,5 @@
 [flake8]
-ignore=E741,E129,W504,A003,B020,B902
+ignore=E741,E129,W504,A003,B023,B902
 max-line-length=240
 per-file-ignores =
   calm/fixes.py:E241,E127
diff --git a/calm/utils.py b/calm/utils.py
index f25e5f4..bafc5ff 100644
--- a/calm/utils.py
+++ b/calm/utils.py
@@ -58,12 +58,12 @@ def makedirs(name):
 
 
 #
-# remove any empty subdirectories
+# remove any empty subdirectories below a given depth
 #
-def rmemptysubdirs(path):
+def rmemptysubdirs(path, depth=3):
     for (dirpath, _subdirs, _files) in os.walk(path, topdown=False, followlinks=True):
-        # don't remove the given directory, only subdirectories
-        if os.path.relpath(dirpath, path) == '.':
+        # don't do anything while above the given depth
+        if len(os.path.relpath(dirpath, path).split(os.sep)) < depth:
             continue
 
         # check whether the directory is now empty after processing any



                 reply	other threads:[~2022-07-02 21:07 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20220702210709.C61EE3858C53@sourceware.org \
    --to=jturney@sourceware.org \
    --cc=cygwin-apps-cvs@sourceware.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).