New rmtree wrapper function

Change-Id: Ie2585946c114ab97a75c0264c93197d27918e759
Signed-off-by: Michael Walsh <micwalsh@us.ibm.com>
diff --git a/lib/gen_misc.py b/lib/gen_misc.py
index 3f869f5..8857d63 100755
--- a/lib/gen_misc.py
+++ b/lib/gen_misc.py
@@ -8,6 +8,7 @@
 import sys
 import errno
 import os
+import shutil
 import collections
 import json
 import time
@@ -72,6 +73,24 @@
         pass
 
 
+def rmtree(path, ignore_errors=False, onerror=None, quiet=None):
+    r"""
+    Call shutil.rmtree with the caller's arguments.
+
+    This function offers this advantage over the base function:
+    - It will print an "Issuing: shutil.rmtree" message.
+
+    Description of argument(s):
+    (All parms are passed directly to shutil.rmtree.  See its prolog for details)
+    quiet                           Indicates whether this function should run the print_issuing() function.
+    """
+    quiet = int(dft(quiet, gp.get_stack_var('quiet', 0)))
+    print_string = gp.sprint_executing(max_width=2000)
+    print_string = re.sub(r"Executing: ", "Issuing: shutil.", print_string.rstrip("\n"))
+    gp.qprintn(re.sub(r", quiet[ ]?=.*", ")", print_string))
+    shutil.rmtree(path, ignore_errors, onerror)
+
+
 def chdir(path, quiet=None):
     r"""
     Call os.chdir with the caller's arguments.