Skip to content

Commit

Permalink
Allow for arbitary location of message definitions
Browse files Browse the repository at this point in the history
Message definition location for mavgen_python_dialect can be set using MDEF environment variable.
This fixes ArduPilot#596
  • Loading branch information
basil-huber committed Nov 28, 2021
1 parent 069ae75 commit fcf8915
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion generator/mavgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down

0 comments on commit fcf8915

Please sign in to comment.