generator.py: remove before generating
authorPaul Brossier <piem@piem.org>
Mon, 16 Jul 2012 20:01:04 +0000 (14:01 -0600)
committerPaul Brossier <piem@piem.org>
Mon, 16 Jul 2012 20:01:04 +0000 (14:01 -0600)
interfaces/python/generator.py

index 9e783ade5c78e900333ea1b6514a7192104b080f..8fdbc0317d52d4cd7bb1ac1afcf4e7c6d89e8033 100755 (executable)
@@ -2,7 +2,7 @@
 
 """ This file generates a c file from a list of cpp prototypes. """
 
-import os, sys
+import os, sys, shutil
 from gen_pyobject import write_msg, gen_new_init, gen_do, gen_members, gen_methods, gen_finish
 
 def get_cpp_objects():
@@ -28,6 +28,8 @@ def get_cpp_objects():
   return cpp_output, cpp_objects
 
 def generate_object_files():
+  if os.path.isdir('generated'): shutil.rmtree('generated')
+  os.mkdir('generated')
 
   generated_objects = []
   cpp_output, cpp_objects = get_cpp_objects()
@@ -109,7 +111,6 @@ def generate_object_files():
 
 
       # generate this_object
-      if not os.path.isdir('generated'): os.mkdir('generated')
       short_name = object_name[len('aubio_'):]
       if short_name in skip_objects:
               write_msg("-- INFO: skipping object", short_name )