shithub: aubio

Download patch

ref: 51ca615ee63cf70336f190f61ae31d23bbd8e595
parent: 6e5c03aa1b8be49f9521ce000f0b7e475878786e
author: Martin Hermant <martin.hermant@gmail.com>
date: Tue May 30 07:12:55 EDT 2017

gen_external.py : pass skip_object as member of function to allow custom skip_objects lists

--- a/python/lib/gen_external.py
+++ b/python/lib/gen_external.py
@@ -11,7 +11,7 @@
 #include "aubio-types.h"
 """
 
-skip_objects = [
+default_skip_objects = [
     # already in ext/
     'fft',
     'pvoc',
@@ -135,10 +135,13 @@
     return cpp_output
 
 
-def get_cpp_objects_from_c_declarations(c_declarations):
+def get_cpp_objects_from_c_declarations(c_declarations,skip_objects = None):
+    if skip_objects==None:
+        skip_objects = default_skip_objects
     typedefs = filter(lambda y: y.startswith('typedef struct _aubio'), c_declarations)
     cpp_objects = [a.split()[3][:-1] for a in typedefs]
-    return cpp_objects
+    cpp_objects_filtered = filter(lambda y: not y[6:-2] in skip_objects, cpp_objects)
+    return cpp_objects_filtered
 
 
 def get_all_func_names_from_lib(lib, depth=0):
@@ -177,9 +180,6 @@
         shortname = o
         if o[:6] == 'aubio_':
             shortname = o[6:-2]  # without aubio_ prefix and _t suffix
-
-        if shortname in skip_objects:
-            continue
 
         lib[shortname] = {'struct': [], 'new': [], 'del': [], 'do': [], 'get': [], 'set': [], 'other': []}
         lib[shortname]['longname'] = o