doc: fix generate-setting-docs.py for supporting Python 3 sorted() style
Python 3 has no "cmp" argument to sorted().
Fixes: b0da972f5f
This commit is contained in:
@@ -162,13 +162,10 @@ def get_default_value(setting, pspec, propxml):
|
|||||||
|
|
||||||
return default_value
|
return default_value
|
||||||
|
|
||||||
def cmp_settings(x,y):
|
def settings_sort_key(x):
|
||||||
x_prefix = x.attrib['{%s}symbol-prefix' % ns_map['c']]
|
x_prefix = x.attrib['{%s}symbol-prefix' % ns_map['c']]
|
||||||
y_prefix = y.attrib['{%s}symbol-prefix' % ns_map['c']]
|
# always sort NMSettingConnection first
|
||||||
if x_prefix == "setting_connection":
|
return (x_prefix != "setting_connection", x_prefix);
|
||||||
# Always sort NMSettingConnection first
|
|
||||||
return -1;
|
|
||||||
return cmp(x_prefix, y_prefix)
|
|
||||||
|
|
||||||
def escape(val):
|
def escape(val):
|
||||||
return str(val).replace('"', '"')
|
return str(val).replace('"', '"')
|
||||||
@@ -194,7 +191,7 @@ settings = girxml.findall('./gi:namespace/gi:class[@parent="Setting"]', ns_map)
|
|||||||
# Hack. Need a better way to do this
|
# Hack. Need a better way to do this
|
||||||
ipxml = girxml.find('./gi:namespace/gi:class[@name="SettingIPConfig"]', ns_map)
|
ipxml = girxml.find('./gi:namespace/gi:class[@name="SettingIPConfig"]', ns_map)
|
||||||
settings.extend(girxml.findall('./gi:namespace/gi:class[@parent="SettingIPConfig"]', ns_map))
|
settings.extend(girxml.findall('./gi:namespace/gi:class[@parent="SettingIPConfig"]', ns_map))
|
||||||
settings = sorted(settings, cmp=cmp_settings)
|
settings = sorted(settings, key=settings_sort_key)
|
||||||
|
|
||||||
init_constants(girxml, settings)
|
init_constants(girxml, settings)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user