| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
| |
This fixes support for macros like `g_message()` in GLib.
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
|
|
|
|
|
|
|
| |
This fixes support for macros like `G_BREAKPOINT()` or `G_DEBUG_HERE()`
in GLib.
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
|
|
|
|
|
|
|
|
|
| |
It seems that optparse might just ignore storing options without a
default. In this case, the `--compiler` option should be initialised to
`None`, but instead it just gets ignored.
Without the `hasattr()` check, updating the introspection data for GLib
fails with a Python backtrace.
|
|
|
|
|
| |
We need it for close(), especially when unistd.h is not available, such as in
the case of Visual Studio-style builds.
|
|
|
|
|
|
|
|
|
| |
This reverts commit 8e85d1ca937c166f07675d02fc84abb27d06ae11.
Marking colliding properties as not introspectable breaks
a bunch of existing API when compiling the GIR into the
typelib, so we'll have to find another solution during the
grace period.
|
|
|
|
|
|
|
|
|
|
|
|
| |
We currently use the `CC` environment variable to find the C compiler to
use internally in g-ir-scanner. Build systems might wish to store the
compiler detected during the build configuration, and then pass that
compiler to g-ir-scanner at the time of build, avoiding to put things
into the environment.
One possible solution is to have a command line argument that lets us
specify the C compiler, with the same semantics as the `CC` environment
variable.
|
|
|
|
|
|
|
|
|
| |
Follow the same semantics as Vala:
1. emitters should have the same return value as the signal
2. emitters should have the same parameters as the signal they
emit (minus the instance parameter, which is implied in
signals)
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
We need to use log_node(), not a plain log().
|
|
|
|
|
| |
We prefer methods, signals, and virtual methods to properties, in case
of a collision.
|
|
|
|
|
| |
This way we only raise a warning when operating under the newly added
strict mode.
|
|
|
|
|
|
|
|
|
| |
To avoid introducing additional strictness onto unsuspecting libraries,
we introduce a new mode: "strict".
The strict mode is opt-in, and used to signal potential issues with the
public API once exposed by language bindings, even when it's fully
introspectable.
|
|
|
|
|
|
|
|
|
|
|
| |
Properties cannot have the same name as signals, methods, and virtual
functions, as they will break various language bindings.
Since listing this requirement only in the documentation has been
insufficient, we should emit a warning, and hope that library developers
will pay attention to it.
Fixes: #386
|
|
|
|
|
| |
By default, stdout is in text mode, expecting a str rather than byte.
Change the output destination to the underlying binary buffer to write bytes.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
Fixes #416
|
|
|
|
|
|
|
|
|
|
|
|
| |
The hack that copies the doctemplates directory into the build
directory has stopped working with newer versions of Meson; while it's
possible to copy files, custom_target() cannot depend on a directory.
Additionally, the dependency has always been broken.
Instead, we enumerate the template files—after all, it's not like they
change a lot—and then we list them as dependencies for the test targets.
Fixes: #414
|
|
|
|
|
|
| |
We can find the templates directory using the module file once
installed, but when running uninstalled we need to have a way to specify
where the templates can be found in the sources directory.
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
| |
GJS now maps GLib.ByteArray and GLib.Bytes to Uint8Array whenever
possible. Change the string returned by docwriter for devdocs to
reflect that.
|
|
|
|
|
|
|
|
|
| |
Those types should map by definition to guintptr and gintptr.
They are fairly common in Rust cbindgen projects, which maps
usize->uintptr_t for ex.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
For historical reasons, we have boxed types that do not follow the
typical conversion from CamelCase to snake_case when it comes to their
get_type function.
The introspection scanner will correctly detect that a type is matched
to that get_type function, but then it will default to tokenize the
get_type function to set the c_symbol_prefix of the given type.
The method pairing code in the main transformation path takes that
mismatch into consideration, but the constructor pairing code does not.
This leads to interesting cases, like GString.
GString is correctly detected as GLib.String, and correctly matched to
its `g_gstring_get_type()` type function, but its c_symbol_prefix is set
to `gstring` after the tokenization. While methods like
`g_string_append()` are correctly paired to the `GLib.String` node,
constructors like `g_string_new()` do not, and end up being turned into
function nodes, like `GLib.string_new`, even if they are annotated as
constructors.
I'm not entirely confident that changing the c_symbol_prefix
tokenization this late in the game is going to be free of regressions;
instead, we provide a way for pairing constructors if they are annotated
as such.
In other words: non-annotated constructors of types that have a
different symbol prefix than the one of the get_type function will stay
as they are today—a global function. To enforce the matching, we rely on
an explicit `(constructor)` annotation; at least, this should ensure
that we have explicit buy in from the maintainers of the API.
Fixes: #399
|
|
|
|
|
|
|
| |
If a property is not introspectable we need to decouple it from its
accessors; the property data will not be compiled into the typelib,
and when the compiler will try to resolve the offsets into the binary
blob we'll get a fatal exception.
|
|
|
|
|
|
|
| |
Some readonly boolean properties in the form of 'has-foo' or 'is-bar'
expose a getter function in the form of `get_has_foo()` or
`get_is_bar()`, according to extant coding practices. We should ensure
we still check for those.
|
|
|
|
|
|
| |
If the (set-property) and (get-property) annotations on methods do not
round trip with the (setter) and (getter) annotations on the
corresponding property, we want to emit a warning.
|
|
|
|
|
|
|
|
| |
If a property is boolean and read-only, the getter method can be the
same as the property name, for instance:
- gtk_widget_has_focus()
- gtk_media_stream_has_audio()
|
|
|
|
|
|
|
| |
The heuristic is pretty trivial: for any given non-construct-only,
writable property, we check if there's a `set_<property>` method; for
any given readable property, we check if there's a `get_<property>`
method.
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
| |
A "final" class is a leaf node in a derivable type hierarchy, and cannot
be derived any further.
This matches the changes in libgobject that introduced G_TYPE_FLAG_FINAL
to the type flags.
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
| |
This member will contain the string from the GEnumValue/GFlagsValue
'value_name' introspection dump.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
|
|
|
|
|
|
| |
Don't rely on runtime name, but on C header parsed symbol.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
|
|
|
|
|
|
|
|
|
| |
Check for errors during g_file_open_tmp() and fdopen(). Make sure to
free tmp_name and error as needed.
Found with Coverity.
https://bugzilla.redhat.com/show_bug.cgi?id=1938731
|
|
|
|
|
|
|
|
|
|
| |
Because of skepticism I received in #224, I made this PR which keeps the
testsuite and CI improvements but doesn't add any new build options. I
hope this would be less controversial:
- no new knobs
- tests for those using existing build options
- CI tests `build_introspection_data = false`
|
|
|
|
|
|
|
|
|
| |
The scanner is chocking on the `__float80` and `__float128` types that
are provided by GCC as extensions to ISO/IEC TS 18661-3:2015:
https://gcc.gnu.org/onlinedocs/gcc/Floating-Types.html
Fixes: #384
|
|\
| |
| |
| |
| | |
Add basic mypy support; Require Python 3.5
See merge request GNOME/gobject-introspection!251
|
| |
| |
| |
| |
| |
| | |
Silence some errors, run mypy in CI
Adding annotations to functions/classes will make mypy check them.
|
|\ \
| | |
| | |
| | |
| | | |
giscanner: always define PY_SSIZE_T_CLEAN
See merge request GNOME/gobject-introspection!244
|
| | |
| | |
| | |
| | | |
This is required for Python 3.10 and always a good idea anyway.
|
|\ \ \
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Don't assume Py_TYPE being a macro
Closes #358
See merge request GNOME/gobject-introspection!243
|
| |/ /
| | |
| | |
| | |
| | |
| | |
| | | |
It got changed to a function in Python 3.10. Use the Py_SET_TYPE macro
suggested at https://docs.python.org/3.10/whatsnew/3.10.html instead.
Fixes #358
|
|\ \ \
| | | |
| | | |
| | | |
| | | | |
open cleanup: explicit encoding, close fds
See merge request GNOME/gobject-introspection!250
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
This means flushing changes and closing the fd. Otherwise this is done
by the GC eventually..
Detected using PYTHONTRACEMALLOC=1 PYTHONDEVMODE=1
|
| | |/
| |/|
| | |
| | |
| | |
| | |
| | |
| | | |
Otherwise we'll end up using the locale encoding. While it's usually utf-8,
that's not the case on Windows.
There is one place where a file with filenames is passed, not sure there
so I left it and passed a explicit None.
|
|/ /
| |
| |
| |
| | |
From what I can see this was used for importing the C ext in an uninstalled
libtool build of g-i. We no longer use libtool, so this is no longer needed.
|
|/ |
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
| |
os.path.relpath() will throw a ValueError when the two paths that
are fed to it are on different drives, at least when running under
cmd.exe consoles.
Fix this by falling back to the full path when this ValueError is
thrown.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|