bug 1517: waf clean/distclean doesn't remove the doc/html directory
authorTom Henderson <tomh@tomh.org>
Mon, 18 Feb 2013 20:22:50 -0800
changeset 9239 02de8e19ce08
parent 9238 e6c89f14f09b
child 9240 0f783cfd9041
bug 1517: waf clean/distclean doesn't remove the doc/html directory
wscript
--- a/wscript	Mon Feb 18 10:35:03 2013 -0500
+++ b/wscript	Mon Feb 18 20:22:50 2013 -0800
@@ -712,6 +712,10 @@
     bld.exclude_taskgen = types.MethodType(_exclude_taskgen, bld)
     bld.find_ns3_module = types.MethodType(_find_ns3_module, bld)
 
+    # Clean documentation build directories; other cleaning happens later
+    if bld.cmd == 'clean':
+        _cleandocs()
+
     # process subfolders from here
     bld.add_subdirs('src')
 
@@ -851,7 +855,26 @@
         _doxygen(bld)
         raise SystemExit(0)
 
+def _cleandir(name):
+    try:
+        shutil.rmtree(name)
+    except:
+        pass
 
+def _cleandocs():
+    _cleandir('doc/html')
+    _cleandir('doc/manual/build')
+    _cleandir('doc/tutorial/build')
+    _cleandir('doc/tutorial-pt/build')
+    _cleandir('doc/models/build')
+    _cleandir('doc/models/source-temp')
+
+# 'distclean' typically only cleans out build/ directory
+# Here we clean out any build or documentation artifacts not in build/
+def distclean(ctx):
+    _cleandocs()
+    # Now call waf's normal distclean
+    Scripting.distclean(ctx)
 
 def shutdown(ctx):
     bld = wutils.bld