[kernel] r7820 -
dists/trunk/linux-2.6/debian/lib/python/debian_linux
Bastian Blank
waldi at alioth.debian.org
Sun Nov 19 12:13:25 UTC 2006
Author: waldi
Date: Sun Nov 19 13:13:25 2006
New Revision: 7820
Modified:
dists/trunk/linux-2.6/debian/lib/python/debian_linux/utils.py
Log:
debian/lib/python/debian_linux/utils.py: Add rmtree.
Modified: dists/trunk/linux-2.6/debian/lib/python/debian_linux/utils.py
==============================================================================
--- dists/trunk/linux-2.6/debian/lib/python/debian_linux/utils.py (original)
+++ dists/trunk/linux-2.6/debian/lib/python/debian_linux/utils.py Sun Nov 19 13:13:25 2006
@@ -138,3 +138,17 @@
r'(\s+|' # any whitespace
r'(?<=[\w\!\"\'\&\.\,\?])-{2,}(?=\w))') # em-dash
+def rmtree(dir):
+ import os, os.path, stat
+ for root, dirs, files in os.walk(dir, topdown=False):
+ for name in files:
+ os.remove(os.path.join(root, name))
+ for name in dirs:
+ real = os.path.join(root, name)
+ mode = os.lstat(real)[stat.ST_MODE]
+ if stat.S_ISDIR(mode):
+ os.rmdir(real)
+ else:
+ os.remove(real)
+ os.rmdir(dir)
+
More information about the Kernel-svn-changes
mailing list