mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-02-23 16:23:56 -04:00
AP_HAL_ChibiOS: Tweak sorting to be py2/py3 compatible
This commit is contained in:
parent
bf4f482f5e
commit
8813057b4c
@ -8,6 +8,7 @@ This assumes a csv file extracted from the datasheet using tablula:
|
||||
'''
|
||||
|
||||
import sys, csv, os
|
||||
from functools import cmp_to_key
|
||||
|
||||
def is_pin(str):
|
||||
'''see if a string is a valid pin name'''
|
||||
@ -88,7 +89,7 @@ parse_af_table(sys.argv[1], table)
|
||||
sys.stdout.write("AltFunction_map = {\n");
|
||||
sys.stdout.write('\t# format is PIN:FUNCTION : AFNUM\n')
|
||||
sys.stdout.write('\t# extracted from %s\n' % os.path.basename(sys.argv[1]))
|
||||
for k in sorted(table.keys(), cmp=pin_compare):
|
||||
for k in sorted(table.keys(), key=cmp_to_key(pin_compare)):
|
||||
s = '"' + k + '"'
|
||||
sys.stdout.write('\t%-20s\t:\t%s,\n' % (s, table[k]))
|
||||
sys.stdout.write("}\n");
|
||||
|
Loading…
Reference in New Issue
Block a user