Skip to content

Commit e7370ce

Browse files
committed
Simplify and use helpers
1 parent c99a712 commit e7370ce

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/manage/uninstall_command.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,7 @@ def _do_purge_global_dir(global_dir, warn_msg, *, hive=None, subkey="Environment
6666
if not global_dir.is_dir():
6767
return
6868
LOGGER.info("Purging global commands from %s", global_dir)
69-
for f in _iterdir(global_dir):
70-
LOGGER.debug("Purging %s", f)
71-
rmtree(f, after_5s_warning=warn_msg)
69+
rmtree(global_dir, after_5s_warning=warn_msg)
7270

7371

7472
def execute(cmd):
@@ -110,11 +108,11 @@ def execute(cmd):
110108
cleanup(cmd, [])
111109
# Clean up other lingering directories
112110
LOGGER.info("Purging remaining files")
113-
for d in cmd.install_dir.iterdir():
111+
for d in _iterdir(cmd.install_dir):
114112
if d.is_dir():
115113
LOGGER.verbose("Removing %s", d)
116114
rmtree(d, after_5s_warning=warn_msg.format("remaining files"))
117-
if any(cmd.install_dir.iterdir()):
115+
if any(_iterdir(cmd.install_dir)):
118116
LOGGER.warn("Unable to fully remove %s.", cmd.install_dir)
119117
LOGGER.debug("END uninstall_command.execute")
120118
return

0 commit comments

Comments
 (0)