mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-20 23:58:54 +02:00
gdbus-codegen: Use Color's print_* methods
`glib-genmarshal` and `glib-mkenums` use a `Color` class which implements a number of print_* methods to print colored messages to the standard error output. In order to be consistent with those programs' output, `gdbus-codegen` has also started using that same class and methods. https://bugzilla.gnome.org/show_bug.cgi?id=791015
This commit is contained in:
@@ -23,6 +23,7 @@ import sys
|
||||
import xml.parsers.expat
|
||||
|
||||
from . import dbustypes
|
||||
from .utils import print_error
|
||||
|
||||
class DBusXMLParser:
|
||||
STATE_TOP = 'top'
|
||||
@@ -203,7 +204,7 @@ class DBusXMLParser:
|
||||
elif direction == 'out':
|
||||
self._cur_object.out_args.append(arg)
|
||||
else:
|
||||
raise RuntimeError('Invalid direction "%s"'%(direction))
|
||||
print_error('Invalid direction "{}"'.format(direction))
|
||||
self._cur_object = arg
|
||||
elif name == DBusXMLParser.STATE_ANNOTATION:
|
||||
self.state = DBusXMLParser.STATE_ANNOTATION
|
||||
@@ -278,7 +279,7 @@ class DBusXMLParser:
|
||||
self.state = DBusXMLParser.STATE_IGNORED
|
||||
|
||||
else:
|
||||
raise RuntimeError('Unhandled state "%s" while entering element with name "%s"'%(self.state, name))
|
||||
print_error('Unhandled state "{}" while entering element with name "{}"'.format(self.state, name))
|
||||
|
||||
self.state_stack.append(old_state)
|
||||
self._cur_object_stack.append(old_cur_object)
|
||||
|
Reference in New Issue
Block a user