From: Michael Tremer Date: Fri, 27 May 2022 10:22:58 +0000 (+0000) Subject: util: Drop rm function X-Git-Tag: 0.9.28~723 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1459bf1945380e97b86b0a96bb764d3c0ce3901a;p=pakfire.git util: Drop rm function Signed-off-by: Michael Tremer --- diff --git a/src/pakfire/util.py b/src/pakfire/util.py index 74d257ac3..7a2c9b65a 100644 --- a/src/pakfire/util.py +++ b/src/pakfire/util.py @@ -19,9 +19,7 @@ # # ############################################################################### -import os import platform -import shutil def get_distro_name(): """ @@ -53,26 +51,3 @@ def _read_os_release(): pass raise OSError("Could not find os-release") - -def rm(path, *args, **kargs): - """ - version of shutil.rmtree that ignores no-such-file-or-directory errors, - and tries harder if it finds immutable files - """ - tryAgain = 1 - failedFilename = None - while tryAgain: - tryAgain = 0 - try: - shutil.rmtree(path, *args, **kargs) - except OSError as e: - if e.errno == 2: # no such file or directory - pass - elif e.errno==1 or e.errno==13: - tryAgain = 1 - if failedFilename == e.filename: - raise - failedFilename = e.filename - os.system("chattr -R -i %s" % path) - else: - raise