summarylogtreecommitdiffstats
path: root/PARROT-DEV-if-include-xml-files-does-not-exist-in-same-dire.patch
blob: 5531416fd0d8df447cf978a7faa12629ac5835cd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
From 41ba6842262d7a0150b0e942007e92194b21bccd Mon Sep 17 00:00:00 2001
From: Jean-Baptiste Dubois <jean-baptiste.dubois@parrot.com>
Edited by: Alexandre Iooss <alexandre.iooss@gmail.com>
Date: Wed, 22 Apr 2015 18:44:10 +0200
Subject: [PATCH 03/10] [DEV] if <include> xml files does not exist in same
 directory try with mavlink default dir

Change-Id: I6bb26be945e9b890e07bc7c4d71a6e9b08ff06e7
---
 pymavlink/generator/mavgen.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/pymavlink/generator/mavgen.py b/pymavlink/generator/mavgen.py
index 2996350..a5dfd9c 100755
--- a/pymavlink/generator/mavgen.py
+++ b/pymavlink/generator/mavgen.py
@@ -61,6 +61,10 @@ def mavgen(opts, args) :
     for x in xml[:]:
         for i in x.include:
             fname = os.path.join(os.path.dirname(x.filename), i)
+            ## if xml file does not exist try to with mavlink "dialects" directory
+            if not os.path.exists(fname):
+                fname = os.path.join(os.path.dirname(__file__), "..",
+                    "dialects", "v10", i)
 
             ## Validate XML file with XSD file if possible.
             if opts.validate:
-- 
2.9.3