mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-24 21:16:15 +01:00
gdbus-codegen: Tidy up version comparisons
Python tuple comparisons actually do what we want for comparing major and minor versions, so tidy things up by using that. This introduces no functional changes. Signed-off-by: Philip Withnall <withnall@endlessm.com>
This commit is contained in:
parent
9734e4854e
commit
087b9829f4
@ -73,10 +73,6 @@ class HeaderCodeGenerator:
|
||||
self.glib_min_required = glib_min_required
|
||||
self.outfile = outfile
|
||||
|
||||
self.glib_min_required_is_2_64 = (glib_min_required[0] > 2 or
|
||||
(glib_min_required[0] == 2 and
|
||||
glib_min_required[1] >= 64))
|
||||
|
||||
# ----------------------------------------------------------------------------------------------------
|
||||
|
||||
def generate_header_preamble(self):
|
||||
@ -226,7 +222,7 @@ class HeaderCodeGenerator:
|
||||
' %s *proxy'%(i.name_lower, m.name_lower, i.camel_name))
|
||||
for a in m.in_args:
|
||||
self.outfile.write(',\n %sarg_%s'%(a.ctype_in, a.name))
|
||||
if self.glib_min_required_is_2_64:
|
||||
if self.glib_min_required >= (2, 64):
|
||||
self.outfile.write(',\n GDBusCallFlags call_flags'
|
||||
',\n gint timeout_msec')
|
||||
if m.unix_fd:
|
||||
@ -256,7 +252,7 @@ class HeaderCodeGenerator:
|
||||
' %s *proxy'%(i.name_lower, m.name_lower, i.camel_name))
|
||||
for a in m.in_args:
|
||||
self.outfile.write(',\n %sarg_%s'%(a.ctype_in, a.name))
|
||||
if self.glib_min_required_is_2_64:
|
||||
if self.glib_min_required >= (2, 64):
|
||||
self.outfile.write(',\n GDBusCallFlags call_flags'
|
||||
',\n gint timeout_msec')
|
||||
if m.unix_fd:
|
||||
@ -926,10 +922,6 @@ class CodeGenerator:
|
||||
self.glib_min_required = glib_min_required
|
||||
self.outfile = outfile
|
||||
|
||||
self.glib_min_required_is_2_64 = (glib_min_required[0] > 2 or
|
||||
(glib_min_required[0] == 2 and
|
||||
glib_min_required[1] >= 64))
|
||||
|
||||
# ----------------------------------------------------------------------------------------------------
|
||||
|
||||
def generate_body_preamble(self):
|
||||
@ -1680,7 +1672,7 @@ class CodeGenerator:
|
||||
%(i.name_lower, m.name_lower, i.camel_name))
|
||||
for a in m.in_args:
|
||||
self.outfile.write(' * @arg_%s: Argument to pass with the method invocation.\n'%(a.name))
|
||||
if self.glib_min_required_is_2_64:
|
||||
if self.glib_min_required >= (2, 64):
|
||||
self.outfile.write(' * @call_flags: Flags from the #GDBusCallFlags enumeration. If you want to allow interactive\n'
|
||||
' authorization be sure to set %G_DBUS_CALL_FLAGS_ALLOW_INTERACTIVE_AUTHORIZATION.\n'
|
||||
' * @timeout_msec: The timeout in milliseconds (with %G_MAXINT meaning "infinite") or\n'
|
||||
@ -1704,7 +1696,7 @@ class CodeGenerator:
|
||||
' %s *proxy'%(i.name_lower, m.name_lower, i.camel_name))
|
||||
for a in m.in_args:
|
||||
self.outfile.write(',\n %sarg_%s'%(a.ctype_in, a.name))
|
||||
if self.glib_min_required_is_2_64:
|
||||
if self.glib_min_required >= (2, 64):
|
||||
self.outfile.write(',\n GDBusCallFlags call_flags'
|
||||
',\n gint timeout_msec')
|
||||
if m.unix_fd:
|
||||
@ -1726,7 +1718,7 @@ class CodeGenerator:
|
||||
for a in m.in_args:
|
||||
self.outfile.write(',\n arg_%s'%(a.name))
|
||||
self.outfile.write('),\n')
|
||||
if self.glib_min_required_is_2_64:
|
||||
if self.glib_min_required >= (2, 64):
|
||||
self.outfile.write(' call_flags,\n'
|
||||
' timeout_msec,\n')
|
||||
else:
|
||||
@ -1797,7 +1789,7 @@ class CodeGenerator:
|
||||
%(i.name_lower, m.name_lower, i.camel_name))
|
||||
for a in m.in_args:
|
||||
self.outfile.write(' * @arg_%s: Argument to pass with the method invocation.\n'%(a.name))
|
||||
if self.glib_min_required_is_2_64:
|
||||
if self.glib_min_required >= (2, 64):
|
||||
self.outfile.write(' * @call_flags: Flags from the #GDBusCallFlags enumeration. If you want to allow interactive\n'
|
||||
' authorization be sure to set %G_DBUS_CALL_FLAGS_ALLOW_INTERACTIVE_AUTHORIZATION.\n'
|
||||
' * @timeout_msec: The timeout in milliseconds (with %G_MAXINT meaning "infinite") or\n'
|
||||
@ -1824,7 +1816,7 @@ class CodeGenerator:
|
||||
' %s *proxy'%(i.name_lower, m.name_lower, i.camel_name))
|
||||
for a in m.in_args:
|
||||
self.outfile.write(',\n %sarg_%s'%(a.ctype_in, a.name))
|
||||
if self.glib_min_required_is_2_64:
|
||||
if self.glib_min_required >= (2, 64):
|
||||
self.outfile.write(',\n GDBusCallFlags call_flags'
|
||||
',\n gint timeout_msec')
|
||||
if m.unix_fd:
|
||||
@ -1850,7 +1842,7 @@ class CodeGenerator:
|
||||
for a in m.in_args:
|
||||
self.outfile.write(',\n arg_%s'%(a.name))
|
||||
self.outfile.write('),\n')
|
||||
if self.glib_min_required_is_2_64:
|
||||
if self.glib_min_required >= (2, 64):
|
||||
self.outfile.write(' call_flags,\n'
|
||||
' timeout_msec,\n')
|
||||
else:
|
||||
|
@ -251,8 +251,7 @@ def codegen_main():
|
||||
print_error('Unrecognized --glib-min-required string ‘{}’'.format(
|
||||
args.glib_min_required))
|
||||
|
||||
if glib_min_required[0] < 2 or \
|
||||
(glib_min_required[0] == 2 and glib_min_required[1] < 30):
|
||||
if glib_min_required < (2, 30):
|
||||
print_error('Invalid --glib-min-required string ‘{}’: minimum '
|
||||
'version is 2.30'.format(args.glib_min_required))
|
||||
else:
|
||||
@ -280,17 +279,13 @@ def codegen_main():
|
||||
print_error('Invalid versions: --glib-min-required ({}) must be '
|
||||
'less than or equal to --glib-max-allowed ({})'.format(glib_min_required, glib_max_allowed))
|
||||
|
||||
glib_min_required_is_2_64 = (glib_min_required[0] > 2 or
|
||||
(glib_min_required[0] == 2 and
|
||||
glib_min_required[1] >= 64))
|
||||
|
||||
all_ifaces = []
|
||||
input_files_basenames = []
|
||||
for fname in sorted(args.files + args.xml_files):
|
||||
with open(fname, 'rb') as f:
|
||||
xml_data = f.read()
|
||||
parsed_ifaces = parser.parse_dbus_xml(xml_data,
|
||||
h_type_implies_unix_fd=glib_min_required_is_2_64)
|
||||
h_type_implies_unix_fd=(glib_min_required >= (2, 64)))
|
||||
all_ifaces.extend(parsed_ifaces)
|
||||
input_files_basenames.append(os.path.basename(fname))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user