vppapigen: list imports in JSON 47/28347/1
authorOndrej Fabry <ofabry@cisco.com>
Mon, 3 Feb 2020 22:25:23 +0000 (23:25 +0100)
committerAndrew Yourtchenko <ayourtch@gmail.com>
Thu, 13 Aug 2020 08:12:25 +0000 (08:12 +0000)
Type: fix

Change-Id: If50477f2487d8c13f91c119a1492370e6e937904
Signed-off-by: Ondrej Fabry <ofabry@cisco.com>
(cherry picked from commit eec5d48040695e45c4880adb59bb18ebacd667c1)

src/tools/vppapigen/vppapigen_json.py

index 95f9e5e..6c2a3a8 100644 (file)
@@ -1,6 +1,12 @@
 # JSON generation
 import json
 
+def walk_imports(s):
+    r = []
+    for e in s:
+        r.append(str(e))
+    return r
+
 
 def walk_enums(s):
     r = []
@@ -69,4 +75,5 @@ def run(filename, s):
     j['options'] = s['Option']
     j['aliases'] = {o.name:o.alias for o in s['types'] if o.__class__.__name__ == 'Using'}
     j['vl_api_version'] = hex(s['file_crc'])
+    j['imports'] = walk_imports(i for i in s['Import'])
     return json.dumps(j, indent=4, separators=(',', ': '))