summaryrefslogtreecommitdiff
path: root/distutils2/command/cmd.py
diff options
context:
space:
mode:
author?ric Araujo <merwok@netwok.org>2012-05-21 16:54:12 -0400
committer?ric Araujo <merwok@netwok.org>2012-05-21 16:54:12 -0400
commitee6fb9f7f0863a1d0020d57f224947f7b795df6d (patch)
treeb8d155316b2f697621264a83a0ef2ef2802c6859 /distutils2/command/cmd.py
parentc57cf8ba29e0b51e614cac580413a183061834d5 (diff)
parent1ed1781f2170be33392c3056f239766b1b1c6a58 (diff)
downloaddisutils2-ee6fb9f7f0863a1d0020d57f224947f7b795df6d.tar.gz
Merge default
Diffstat (limited to 'distutils2/command/cmd.py')
-rw-r--r--distutils2/command/cmd.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/distutils2/command/cmd.py b/distutils2/command/cmd.py
index 6ef7554..2601db0 100644
--- a/distutils2/command/cmd.py
+++ b/distutils2/command/cmd.py
@@ -5,7 +5,7 @@ import re
from distutils2 import util
from distutils2 import logger
from distutils2.errors import PackagingOptionError
-from distutils2._backport.shutil import copyfile, move, make_archive
+from distutils2._backport.shutil import copyfile, move, make_archive, rmtree
class Command:
@@ -365,6 +365,20 @@ class Command:
return
os.makedirs(name, mode)
+ def rmpath(self, name, dry_run=None):
+ if dry_run is None:
+ dry_run = self.dry_run
+ name = os.path.normpath(name)
+ if not os.path.isdir(name) or name == '':
+ return
+ if dry_run:
+ head = ''
+ for part in name.split(os.sep):
+ logger.info("removing directory %s%s", head, part)
+ head += part + os.sep
+ return
+ rmtree(name)
+
def copy_file(self, infile, outfile,
preserve_mode=True, preserve_times=True, link=None, level=1):
"""Copy a file respecting dry-run and force flags.