VPPAPIGEN: Improve output module finding for out-of-tree builds. 15/10915/2
authorOle Troan <ot@cisco.com>
Thu, 1 Mar 2018 12:33:39 +0000 (13:33 +0100)
committerDamjan Marion <dmarion.lists@gmail.com>
Sat, 3 Mar 2018 10:17:18 +0000 (10:17 +0000)
Change-Id: I3b646d84586dd61018f71cbf21c971c97fda75c1
Signed-off-by: Ole Troan <ot@cisco.com>
src/tools/vppapigen/vppapigen.py

index 81f26fe..a230e22 100755 (executable)
@@ -720,11 +720,21 @@ def main():
     import imp
 
     # Default path
+    pluginpath = ''
     if not args.pluginpath:
-        pluginpath = os.path.dirname(os.path.realpath(__file__)) + \
-                                     '/../share/vpp/'
+        cand = []
+        cand.append(os.path.dirname(os.path.realpath(__file__)))
+        cand.append(os.path.dirname(os.path.realpath(__file__)) + \
+                    '/../share/vpp/')
+        for c in cand:
+            c += '/'
+            if os.path.isfile(c + args.output_module + '.py'):
+                pluginpath = c
+                break
     else:
         pluginpath = args.pluginpath + '/'
+    if pluginpath == '':
+        raise Exception('Output plugin not found')
     module_path = pluginpath + args.output_module + '.py'
 
     try: