From fcf8915eb31cf72581aaf2c1e12a8e435dbbdfdd Mon Sep 17 00:00:00 2001 From: Basil Huber Date: Sun, 28 Nov 2021 18:58:01 +0100 Subject: [PATCH] Allow for arbitary location of message definitions Message definition location for mavgen_python_dialect can be set using MDEF environment variable. This fixes #596 --- generator/mavgen.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/generator/mavgen.py b/generator/mavgen.py index ea62c9618..c74c8d686 100755 --- a/generator/mavgen.py +++ b/generator/mavgen.py @@ -301,7 +301,10 @@ def __init__(self, output, wire_protocol=DEFAULT_WIRE_PROTOCOL, language=DEFAULT def mavgen_python_dialect(dialect, wire_protocol): '''generate the python code on the fly for a MAVLink dialect''' dialects = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', 'dialects') - mdef = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', '..', 'message_definitions') + if 'MDEF' in os.environ: + mdef = os.environ['MDEF'] + else: + mdef = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', '..', 'message_definitions') if wire_protocol == mavparse.PROTOCOL_0_9: py = os.path.join(dialects, 'v09', dialect + '.py') xml = os.path.join(dialects, 'v09', dialect + '.xml')