| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
| |
Signals that have an emitter function should have an annotation to allow
consumers of the introspection XML to effectively pair signals to their
corresponding emitter functions that share the same prototype.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
MSYS2 recently updated Python to 3.9.10 which triggered a build
issued present in typed_ast, which was fixed in typed_ast 1.5.0:
https://github.com/python/typed_ast/issues/169
The currently used mypy version has an upper limit on typed_ast, so
this fixed version wasn't pulled in.
To fix this, update mypy, fix one new warning it complains about
(namedtuple not being named after the variable), and install the
markdown stubs explicitely, since mypy no longer bundles them.
|
|
|
|
|
|
|
|
| |
Some functions are meant to exist for the entire duration of the
process, and thus have no need for a notification function because
one will never be called.
Fixes: #49
|
|
|
|
|
| |
We need new annotations to allow library developers to associate a
setter and a getter functions to a property definition.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We introduce two new annotations:
- (set-property PROPERTY_NAME)
- (get-property PROPERTY_NAME)
These annotations are valid inside function blocks for methods on
objects and interfaces, and define whether a function is a property
accessor, e.g.:
/**
* gtk_widget_set_name: (set-property name)
* @self: ...
* @name: ...
*
* ...
*/
/**
* gtk_widget_get_name: (get-property name)
* @self: ...
*
* ...
*
* Returns: ...
*/
The annotations are transformed into the GIR data as attributes:
- glib:set-property="PROPERTY_NAME"
- glib:get-property="PROPERTY_NAME"
The underlying typelib data has had flags for setter and getter
functions for a while, but they have never been plugged into the GIR
data or the introspection scanner. Now they are; you can retrieve the
GIPropertyInfo from a GIFunctionInfo that has the GI_FUNCTION_IS_SETTER
or GI_FUNCTION_IS_GETTER flags set.
Fixes: #13
|
|
|
|
|
|
|
| |
The GNOME developers documentation website has been updated, and we're
in the process of moving API references elsewhere. The old documentation
is still available under developer-old.gnome.org, so let's update the
URLs we have in our documentation.
|
|
|
|
|
|
| |
Silence some errors, run mypy in CI
Adding annotations to functions/classes will make mypy check them.
|
|
|
|
|
|
|
|
|
| |
This reverts commit de6512b31b614567bf1800406303d1ccfb6d9455.
This was causing naming conflicts when the SECTION documentation
was picked over the class documentation.
See https://gitlab.gnome.org/GNOME/gobject-introspection/-/issues/360
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When writing documentation to the GIR files, GIR tries to match
classes with their matching SECTION: comment in the source code. Some codebases
use kebab-case or CamelCase for their section names, but GIR always expects
them to be flatcase or the matching will fail.
This commit converts all section names to flatcase (by removing "-" and
converting to lowercase) while they are being parsed, so that they are matched
properly later on.
Fixes #350.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There was previously no mechanism for tagging enum members
and struct fields with Since tags (or other, eg deprecation tags).
While the customary place to add Since tags for these symbols
is inline in the parent symbol's documentation eg:
/**
* Foo:
*
* @FOO_BAR: some bar. Since X.Y
*/
And variations on that theme, implementing parsing for that scheme
would result in a pretty ambiguous grammar, especially if we also
want support for multiple tags.
Instead, the solution implemented here is to allow providing
documentation for individual members and fields through their
own separate block, as is done for virtual functions already.
Inline comments are still used, with a lower precedence.
Fixes #348
|
|
|
|
| |
The newest flake8 has started to detect this.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
GTK4 allows adding widget-related actions to the documentation with the
newly defined syntax:
<class_name> '|' <action_name> ':'
This means g-ir-scanner needs to detect this new format, to avoid
emitting unnecessary warnings.
Currently, we don't do anything with the actions; in the future we might
want to add them to the documentation in the GIR, but for that we'd need
a new element.
See also: GNOME/gtk-doc!30
|
|
|
|
| |
We only support 3.4+ now.
|
|
|
|
|
|
| |
Mixing ** and explicit keyword arguments is not allowed in Python 2.
Signed-off-by: Nirbheek Chauhan <nirbheek@centricular.com>
|
|
|
|
|
|
|
|
| |
Lesson to be learnt: *NEVER* have a try..except block that catches all
exceptions and turns them into warnings that are silenced by default.
There was a syntax error in this class implementation that made all
annotation parsing fail silently.
|
|
|
|
|
|
|
| |
We already require python 2.7, and it has OrderedDict and Counter.
Besides cleaning up unmaintained code, this change found and fixed
a Python 3 bug where we were iterating over a dict while changing it.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
gpointer parameters and return types should be marked as nullable by
default, unless:
• also annotated with (type) and not with (nullable); or
• explicitly annotated with (not nullable).
This introduces the (not nullable) annotation as a direct opposite to
(nullable). In future, (not) could be extended to invert other
annotations.
https://bugzilla.gnome.org/show_bug.cgi?id=729660
|
|
|
|
|
|
|
|
|
|
| |
Add lt, le, gt, ge, eq, ne, and hash dunder methods to all classes that
implement custom comparisons with __cmp__. This is needed to support Python 3
compatible sorting of instances of these classes.
Avoid using @functools.total_ordering which does not work for some of these
classes and also is not available in Python 2.6.
https://bugzilla.gnome.org/show_bug.cgi?id=679438
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add unicode_literals future import which turns any string literal
into a unicode string. Return unicode strings from the Python C extension
module. Force writing of annotations (g-ir-annotation-tool) to output utf8
encoded data to stdout.
This is an initial pass at following the "unicode sandwich"
model of programming (http://nedbatchelder.com/text/unipain.html)
needed for supporting Python 3.
https://bugzilla.gnome.org/show_bug.cgi?id=679438
|
|
|
|
|
|
|
|
|
|
|
| |
Replace occurances of "%r" (repr) in format strings where the intended
behaviour is to output a quoted string "'foo'" with explicit usage
of "'%s'". This is needed to move the codebase to unicode literals
in order to upgrade to Python 3. Python 2 unicode strings are expanded
with repr formatting prefixed with a "u" as in "u'foo'" which causes
failures for various text formatting scenarios.
https://bugzilla.gnome.org/show_bug.cgi?id=679438
|
|
|
|
|
|
|
| |
Use future import "print_function" and update relevant uses of print
as a function call. See: PEP 3105
https://bugzilla.gnome.org/show_bug.cgi?id=679438
|
|
|
|
|
|
|
|
|
|
| |
Import Python 3 compatible "true division" from the future (PEP 238).
This changes the Python 2 classic division which uses floor division
on integers to true division. Verfied we don't actually use the
division operator anywhere in the code base so this a safety for
supporting both Python 2 and 3.
https://bugzilla.gnome.org/show_bug.cgi?id=679438
|
|
|
|
|
|
|
| |
Not doing this manually all over the place makes
the code slightly more readable.
https://bugzilla.gnome.org/show_bug.cgi?id=689454
|
|
|
|
|
|
| |
02e545371e2132a97458888895cacf57b8c0f83a (2015-06-23)
https://bugzilla.gnome.org/show_bug.cgi?id=725685
|
|
|
|
|
|
|
| |
Allow `identifier`, `parameter` and `tag` part `annotations` fields
to span multiple lines
https://bugzilla.gnome.org/show_bug.cgi?id=676133
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
What we already had:
- (array zero-terminated=1) > array which is NULL terminated
- (array zero-terminated=0) > array which is not NULL terminated
- (array) > array which is not NULL terminated
- (array zero-terminated=X) > array which is not NULL terminated
where X can be anything
What this patch adds:
- (array zero-terminated) > array which is NULL terminated
https://bugzilla.gnome.org/show_bug.cgi?id=657754
|
|
|
|
|
| |
Add ANN_NULLABLE and ANN_OPTIONAL in the one (and only) other place that
ANN_ALLOW_NONE is mentioned...
|
|
|
|
|
|
|
| |
Add (nullable) and (optional) as recognised annotations in the same places that
(allow-none) is allowed. This should have been done in the previous
commits but the tests were passing because the only ill effect was that
a warning was issued.
|
|
|
|
|
|
|
| |
This reverts commit 0839e696e9fbc1942ac5c61054de3b47e9578152.
This was accidentally picked up by my 'git bz apply' against the bug as
I was getting ready to push the last set of changes.
|
|
|
|
|
|
|
|
|
|
|
| |
Add two new annotations, (nullable) and (optional).
(nullable) always means "the type of this value can also contain null".
(optional) always means "this out parameter can be ignored by passing
NULL to the C function".
https://bugzilla.gnome.org/show_bug.cgi?id=660879
|
|
|
|
|
|
|
|
|
| |
The old annotationparser.py happily parsed this, but
giscanner/girwriter.py never serialized an allow-none
attribute to the .gir file and girepository/girparser.c
never looked for an allow-none attribute either.
https://bugzilla.gnome.org/show_bug.cgi?id=660879
|
|
|
|
|
|
|
|
|
|
|
| |
When encountering /**/ in the source, parse_gtk_doc_comment()
would be executed (due to the /** part starting a GTK-Doc
comment block) and would happily consume the / and everything
up until the next comment block was closed or EOF, thus
consuming a whole block of C code...
Encoutered in the wild here:
https://git.gnome.org/browse/clutter-gst/tree/clutter-gst/clutter-gst-player.c?id=03f0d8f48bd7f60e582e6185cb73a07038e8d55d#n1926
|
|
|
|
|
|
| |
Makes our GTK-Doc comment block rewriting tool halt on
such issues, requireing user intervention instead of writing
back even more bogus data.
|
|
|
|
|
| |
makes _parse_annotations() and _parse_fields() callers slightly
more readable
|
|
|
|
|
| |
... so it points to the start of the GTK-Doc comment
block instead of the position of the identifier field.
|
| |
|
|
|
|
|
|
|
| |
GTK-Doc comment block fixer tool will refuse to rewrite source
files that generated errors (indicating a source->parse tree->source
would result in information being lost), but will happily continue
on warnings (which do not result in information being lost).
|
|
|
|
|
|
|
|
|
| |
GTK-Doc parameter description fields are allowed to span
multiple lines, tag description fields are allowed to span
multiple lines and paragraphs. A tool fixing/rewriting
GTK-Doc comment blocks in source files would need to have
description fields parsed and stored (almost) exactly as
they appear in the source file.
|
| |
|
|
|
|
|
|
| |
No need to enumerate the comment lines list as we already receive
the lineno of the very first line as a parameter. Simply increment
that one when looping over the comment lines list.
|
| |
|
|
|
|
|
|
| |
so we can later use them to re-write source files containing
broken GTK-Doc comment blocks where /** is preceded by and/or
*/ is followed by code...
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
- annotations on the identifier (formerly g-i specific tags) have
never been validated before, so fix this
- removes duplicate validation code from GtkDocTag and GtkDocParameter
- remove repeated validation code doing the same thing as
annotationparser from maintransformer...
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
After discussing a different issue with the GTK-Doc maintainers,
we learned that our g-i specific top level tags should never have
existed in the first place. The prefered notation for annotations
that apply to the identifier should be written on the identifier
line, for example like what we already do with (skip).
As a result, this patch deprecates g-i specific top level tags and
implements them as annotations on the identifier instead but still
keeps support for malformed comment blocks using g-i specific top
level tags.
This means that all annotated code "out there" will continue to work
just fine with this version of g-i, but when a developer decides to
fix deprecation warnings in his/her comment blocks, the dependency
on g-i needs to be raised to a version that contains at least this
patch. #676133
https://bugzilla.gnome.org/show_bug.cgi?id=676133
|
|
|
|
|
|
|
|
|
|
| |
- remove annotations regex, restore proper parens parsing
- drop weird DocOption() storage class and use lists/dicts
as appropriate
- make GtkDocAnnotations a simple OrderedDict subclass instead
of a weird hybrid dict/list storage class
- Deprecate Attribute: tag, replace with (attributes) annotation
on the identifier
|
| |
|