[th/introspect-annotations] dbus: support "annotations"/"is_deprecated" option in @dbus.service.{method,signal}
dbus-python implements Introspect()
, but it does not allow to specify
annotations. In particular to mark a method/service as deprecated is
interesting.
Add an optional argument to @dbus.service.{method,signal}
which allows
to specify annotations.
The "annotations" argument is a list of 2-tuples with (name, value). Note that GDBus also supports annotations inside annotations ([1]). We don't do that there, but it maybe could be added in the future by accepting a 3-tuple.
There is also an "is_deprecated" keyword, which, if set to True is a
shortcut for adding a ("org.freedesktop.DBus.Deprecated","true")
annotation. It's probably the most common use of annotations, hence this
convenience argument.
The code does not try to interpret the annotations. For example, if you add an annotation "org.freedesktop.DBus.Deprecated" while also setting "is_deprecated=True", then the deprecated annotation will be set twice. The user us supposed to handle that.
See-also: https://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces-introspectable