summaryrefslogtreecommitdiff
path: root/giscanner
Commit message (Collapse)AuthorAgeFilesLines
* Add glib:name to enum memberMarc-André Lureau2021-06-205-6/+9
| | | | | | | This member will contain the string from the GEnumValue/GFlagsValue 'value_name' introspection dump. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
* scanner: fix enum member c:identifierMarc-André Lureau2021-06-201-1/+5
| | | | | | Don't rely on runtime name, but on C header parsed symbol. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
* giscanner: Improve error handling while parsing macrosDavid King2021-06-181-3/+29
| | | | | | | | | 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
* Make test suite work with cross-related optionsJohn Ericson2021-05-232-1/+8
| | | | | | | | | | 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`
* scanner: Add more float typesebassi/issue-384Emmanuele Bassi2021-04-261-0/+2
| | | | | | | | | 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
* Merge branch 'mypy-basics' into 'master'Christoph Reiter2020-11-083-4/+5
|\ | | | | | | | | Add basic mypy support; Require Python 3.5 See merge request GNOME/gobject-introspection!251
| * Add basic mypy supportChristoph Reiter2020-11-073-4/+5
| | | | | | | | | | | | Silence some errors, run mypy in CI Adding annotations to functions/classes will make mypy check them.
* | Merge branch 'define-PY_SSIZE_T_CLEAN' into 'master'Christoph Reiter2020-11-081-0/+1
|\ \ | | | | | | | | | | | | giscanner: always define PY_SSIZE_T_CLEAN See merge request GNOME/gobject-introspection!244
| * | giscanner: always define PY_SSIZE_T_CLEANChristoph Reiter2020-10-061-0/+1
| | | | | | | | | | | | This is required for Python 3.10 and always a good idea anyway.
* | | Merge branch 'py-type-assign' into 'master'Christoph Reiter2020-11-081-5/+5
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | Don't assume Py_TYPE being a macro Closes #358 See merge request GNOME/gobject-introspection!243
| * | | Don't assume Py_TYPE being a macroChristoph Reiter2020-10-061-5/+5
| |/ / | | | | | | | | | | | | | | | | | | 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
* | | Merge branch 'open-cleanup' into 'master'Christoph Reiter2020-11-078-28/+30
|\ \ \ | | | | | | | | | | | | | | | | open cleanup: explicit encoding, close fds See merge request GNOME/gobject-introspection!250
| * | | Always close filesChristoph Reiter2020-11-072-16/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This means flushing changes and closing the fd. Otherwise this is done by the GC eventually.. Detected using PYTHONTRACEMALLOC=1 PYTHONDEVMODE=1
| * | | Always pass an encoding to open() using text modeChristoph Reiter2020-11-078-12/+12
| | |/ | |/| | | | | | | | | | | | | | | | | | | 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.
* | | Remove LibtoolImporterChristoph Reiter2020-11-074-98/+9
|/ / | | | | | | | | 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.
* | monkey patch distutils.cygwinccompiler.get_msvcrjensgoe2020-10-141-0/+30
|/
* Revert "giscanner: Fix section matching for documentation"Mathieu Duponchelle2020-09-291-6/+1
| | | | | | | | | 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
* gicsanner/message.py: Windows: Fix running on different drivesChun-wei Fan2020-09-261-2/+8
| | | | | | | | | 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.
* giscanner: Fix section matching for documentationJames Westman2020-09-071-1/+6
| | | | | | | | | | | | | 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.
* giscanner: Add support for using clang-clChun-wei Fan2020-08-242-6/+30
| | | | | | | | | | | | | | | | | This adds quick support for using 'clang-cl' (CLang's emulation of the Visual Studio compiler) to run giscanner. This will still initialize things mostly in the MSVC fashion, except that it will also check whether both 'CC' and 'CXX' envvars are set to 'clang-cl [args]', as per the way that Meson supports using 'clang-cl'. Since we are using distutils to set up the compiler instance, when we enable 'clang-cl' support, we trick distutils that we have already initialized the MSVCCompiler parameters as needed. We just leave out the compiler flags as we don't really care about debug symbols nor optimization with the built dumper binary, as it is gone as soon as the .gir file is generated. This will build G-I successfully with all the tests passed.
* Merge branch 'standalone-doc-sections' into 'master'Mathieu Duponchelle2020-07-225-1/+35
|\ | | | | | | | | Add the notion of standalone doc sections. See merge request GNOME/gobject-introspection!226
| * Add the notion of standalone doc sections.Mathieu Duponchelle2020-07-125-1/+35
| | | | | | | | | | | | | | | | Up to now, section annotations had to match a class or interface name in order to be serialized in the gir. With this commit, they now get serialized as docsection nodes, for potential use by documentation tools.
* | giscanner: parse block comments for members and fieldsMathieu Duponchelle2020-07-123-19/+66
|/ | | | | | | | | | | | | | | | | | | | | | | | | | 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
* dumper: Fix missing symbols in LTO case or with overridden symbol visibility ↵Christoph Reiter2020-05-151-2/+2
| | | | | | | | | | | | | | | | | | | | settings In case a user had a combination of -fvisibility=hidden, -Wl,--as-needed, -flto, -O2 in the CFLAGS the linker would sometimes detect that all the referenced gtype functions weren't actually used and throw them out with their providing libraries. Instead of hoping that the user's CFLAGS don't mess without our symbol visibility just use G_MODULE_EXPORT on the two symbols which reference all other gtype and gquark symbols. This fixes errors such as: Invalid GType function: 'gtk_accel_group_get_type' Failed to find symbol 'gtk_accel_group_get_type' during the g-ir-scanner execution. Fixes #280
* flake8: fix invalid placeholder in GtkDocAnnotatable repr format stringChristoph Reiter2020-05-141-1/+1
| | | | The newest flake8 has started to detect this.
* Update utils.pyneok2020-05-101-1/+1
|
* Revert "Add support for element-type to GListModel"Rico Tzschichholz2020-04-284-19/+7
| | | | | | Breaks vapigen and changes GListModel definition in Gio-2.0.gir This reverts commit a9f45431684e6be3623e272e54d481e4c5d9423d.
* Add support for element-type to GListModelEmmanuele Bassi2020-04-264-7/+19
| | | | | | | | GListModel is an interface for creating typed, list-like containers. The data stored is GObject instances, but it's useful to be able to annotate the actual type, for both documentation and code generation purposes. The annotation should be optional, to maintain backward compatibility.
* Revert "Add element-type support to GListModel"Emmanuele Bassi2020-04-262-4/+1
| | | | | | This reverts commit b4c058bba4d95ae10e1e4238f9417fe954f97795. See: #336
* Revert "Generate appropriate docs for ListModel with element-type"Emmanuele Bassi2020-04-261-13/+5
| | | | | | This reverts commit ffe3e435e0b7943a0872034223b5f6ea02258ffa. See: #336
* Generate appropriate docs for ListModel with element-typeEmmanuele Bassi2020-04-241-5/+13
| | | | | | We need to special case the ListModel container type in the documentation writer so that we don't fall back into array/list automatic conversion in the code snippets.
* Add element-type support to GListModelEmmanuele Bassi2020-04-242-1/+4
| | | | | | | | GListModel is an interface for creating typed, list-like containers. The data stored is GObject instances, but it's useful to be able to annotate the actual type, for both documentation and code generation purposes. Fixes: #328
* Support the gtk-doc action syntaxEmmanuele Bassi2020-04-241-6/+36
| | | | | | | | | | | | | | | | 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
* Replace calls to deprecated xml.etree.cElementTreeStephen Gallagher2020-03-262-2/+2
| | | | | | | | | cElementTree was removed in Python 3.9 in favor of ElementTree, which has used a fast, native implementation since Python 3.3. Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1817649 Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
* Windows: Fix building and running on Python 3.8+Chun-wei Fan2020-01-164-1/+53
| | | | | | | | | | | | | | | | | | | | | | | Python 3.8.x and later changed the way how dependent DLLs can be found for a given Python module that depends on the presence of external, non-system DLLs, for more fine-grained DLLs searching and loading, as well as for security purposes, which required the use of os.add_dll_directory(). Thus, the scripts in scanner/ must be updated such that: -We are able to find and load the GObject and GLib DLLs, at least, on initialization, via the use of 'pkg-config --variable bindir', as we already depend on the GLib DLLs. Note that since the gobject-2.0.pc file does not have a 'bindir' entry, we use gio-2.0.pc instead to discover the bindir of the GObject and GLib DLLs. Likewise, we use the same technique for pkg-config files that are dependent upon when using g-ir-scanner (or friends) on items that are higher up in the stack. -We are able to find any other DLLs (e.g. non-GNOME DLLs such as ZLib) that are dependent but are not found in the path(s) given by 'pkg-config --variable bindir' with the envvar GI_EXTRA_BASE_DLL_DIRS, as needed. Note that GI_EXTRA_BASE_DLL_DIRS can be multiple paths, and that the results from 'pkg-config --variable bindir' takes precendence, in a LIFO manner.
* Drop deprecated xml.etree.ElementTree.Element.getchildren() callsMiro Hrončok2020-01-061-6/+6
| | | | | | | | | The XML elements are implicitly iterable in all Python versions including at least 2.7 and 3.2+. The .getchildren() method is deprecated since 2.7 and 3.2, removed in 3.9. Fixes https://gitlab.gnome.org/GNOME/gobject-introspection/issues/325
* giscanner: add a --lib-dirs-envvar optionAlexander Kanavin2019-12-133-3/+7
| | | | | | | | | | By default LD_LIBRARY_PATH is set to the list of target library paths; this breaks down in cross-compilation environment, as we need to run a native emulation wrapper rather than the target binary itself. This patch allows exporting those paths to a different environment variable which can be picked up and used by the wrapper. Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
* giscanner: add a --use-ldd-wrapper optionAlexander Kanavin2019-12-132-1/+6
| | | | | | | This is useful in cross-compile environments where system's ldd command does not work on binaries built for a different architecture Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
* giscanner: add --use-binary-wrapper optionAlexander Kanavin2019-12-131-0/+14
| | | | | | | | | With this option, giscanner will use a wrapper executable to run binaries it's producing, instead of running them directly. This is useful when binaries are cross-compiled and cannot be run directly, but they can be run using for example QEMU emulation. Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
* Fix a bison deprecation warning for using %error-verboseChristoph Reiter2019-12-111-1/+1
| | | | warning: deprecated directive, use ‘%define parse.error verbose’
* giscanner/ccompiler.py: Fix macro defines with quotes on MSVCChun-wei Fan2019-11-011-0/+7
| | | | | | | | | | | | When we save the macros to pass to distutils to compile the dumper program, the quotes were not properly preserved for Visual Studio builds, causing items such as -DG_LOG_DOMAIN to fail as quotes are used in there. When we use quotes in macro definitions, we escape the escape character in ccompiler._set_cpp_options() when we are running g-ir-scanner with Visual Studio, so that distutils won't be too eager to drop those prematurely.
* Evaluate the filters when checking library types in resolve_shlibsAlistair Buxton2019-09-271-2/+2
| | | | | | | | | | In Python 3, filter() returns a filter object for lazy evaluation. This object is truthy, so casting it to bool will return True even if it would contain no objects. This thwarts the test at the beginning of _resolve_non_libtool. To fix this, immediately evaluate the filters with list(). Fixes #314.
* Support array arguments with static keywordEmmanuele Bassi2019-09-151-0/+11
| | | | | | | | | | | | | | | | | | | | | | | C99 allows defining an array argument with a fixed size as: void foo (int arr[static 10]) Compilers conforming to the C99 specification will be able to warn if the function is called with NULL or with an array smaller than the specified length, something that does not happen when using pre-C99 declarations like: void foo (int arr[10]) As the declaration above is identical to: void foo (int arr[]) Which is, in turn, identical to: void foo (int *arr) Fixes: #309
* Make meson.override_find_program working on more complex use casesThibault Saunier2019-08-151-2/+1
| | | | | | | Add some missing `meson.override_find_program` And make sure that the `.gir` we build are found when used uninstalled as a concequence of `meson.override_find_program`.
* ccompiler: use the distutils linker in the dumperChristoph Reiter2019-08-082-5/+10
| | | | | No need to hardcode things since distutils looks it up. Similar to !170 but for Windows.
* Use the defined compiler when invoking libtoolDavid Demelier2019-08-081-1/+1
| | | | Closes: https://gitlab.gnome.org/GNOME/gobject-introspection/issues/303
* meson: abort the build if the correct Python dependency isn't foundChristoph Reiter2019-07-261-0/+5
| | | | | | | For some reason there is no way to pass required to external meson deps. Check manually instead. See #297
* meson: don't pass "install" to configure_file() unless really neededChristoph Reiter2019-07-261-2/+0
| | | | | | | | | | In our case it was never needed because it defaults to true if install_dir is set, which it always is for all calls. This avoids a warning when running with newer meson where it complains that install is only available with 0.50+. Fixes #298
* transformer: only include function macros from headers. See #159Christoph Reiter2019-07-221-0/+4
| | | | | We already do the same thing for constants (see _create_const()). Otherwise macros in .c files which aren't namespaced will trigger a warning.
* scanner: parse and expose function macrosMathieu Duponchelle2019-07-198-5/+98
| | | | | This is useful for documentation tools, and other utilities that rely on full introspection of the C API of a given library.