-
Notifications
You must be signed in to change notification settings - Fork 609
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update mavgen_c to python3 #1000
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,10 @@ | ||
#!/usr/bin/env python | ||
#!/usr/bin/env python3 | ||
''' | ||
parse a MAVLink protocol XML file and generate a C implementation | ||
|
||
Copyright Andrew Tridgell 2011 | ||
Released under GNU GPL version 3 or later | ||
''' | ||
from __future__ import print_function | ||
from future.utils import iteritems | ||
|
||
from builtins import range | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. leaving the |
||
from builtins import object | ||
|
||
import os | ||
from . import mavparse, mavtemplate | ||
|
@@ -675,7 +670,7 @@ def generate_one(basename, xml): | |
# form message name array | ||
xml.message_name_array = '' | ||
# sort by names | ||
for msgid, name in sorted(iteritems(xml.message_names), key=lambda k_v: (k_v[1], k_v[0])): | ||
for msgid, name in sorted(xml.message_names.items(), key=lambda k_v: (k_v[1], k_v[0])): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This runs the same on Python 2 as Python 3. |
||
xml.message_name_array += '{ "%s", %u }, ' % (name, msgid) | ||
xml.message_name_array = xml.message_name_array[:-2] | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
leave this as python for now.