| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
This is useful for documentation tools, and other utilities that
rely on full introspection of the C API of a given library.
|
|
|
|
|
|
|
|
|
|
| |
When using `GI_SCANNER_DEBUG=save-temps`, the temporary input file
to be preprocessed and temporary output file that is result of this
preprocessing are retained for debugging purposes. Use together with
`-v` option to actually determine names of those temporary files.
This should make it easier to determine the source of parsing errors,
like those described in the #247.
|
|\
| |
| |
| |
| | |
Drop all Python 2 compat code
See merge request GNOME/gobject-introspection!85
|
| |
| |
| |
| | |
We only support 3.4+ now.
|
|/
|
|
|
|
|
|
|
|
|
| |
It just printed errors to stderr and always returns success even if parsing
fails. This prevents us to write any tests for it.
As a first step collect all lexing/parsing error messages and print them to stderr after
the scanner is done. This allows us to add some regression tests for !78.
In the future we probably want to raise an exception with those errors if parsing
fails.
|
|
|
|
|
|
| |
This allows us to get rid of the msvc hacks which are needed in case Python
is built with a different msvc than g-i. By passing a filename the FILE struct never
passes over library boundaries.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
g-i includes an old version of pep8 and pyflakes and uses that
during "make check".
It (1) doesn't catch all cases newer versions of pycodestyle/pyflakes catch
and (2) doesn't test all Python files (3) doesn't work with meson.
Instead of updating just remove them and depend on flake8 instead.
To run the checks simply run flake8 in the root dir.
This also makes it possible to run those checks when using meson and
not autotools.
To not get test suite failures on flake8 updates move the checks from
"make check" to an extra "make check.quality" target.
|
|
|
|
|
|
|
|
|
| |
_Thread_local is a C11 keyword, and thread_local is a macro to make it
more confortable to read. As this keyword can only be used in variable
declarations, not in function return values or parameters, it cannot
be included in bindable APIs and we can safely ignore it.
https://bugzilla.gnome.org/show_bug.cgi?id=756921
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
For preprocessing, when we create the temp file for preprocessing, make
the temp file be stored in CWD instead of the system's temp directory;
and when we compile the dumper program, set the output_dir to be the
root directory (<drive letter>:\ on Windows and / otherwise).
This is because distutils insists on using the full path from the root
directory to compile sources, so that if we set the output_dir as we now
do we will get
$(abs_srcdir)/$(tmpdir)/<$(abs_srcdir)_minus_rootdir>/$(tmpdir)/<target_gir_file_name>.[o|obj].
https://bugzilla.gnome.org/show_bug.cgi?id=781525
|
|
|
|
|
|
|
| |
This allows building in both Python 2 and 3 by fixing a few
text/binary ambiguities and using "as" in an except clause.
https://bugzilla.gnome.org/show_bug.cgi?id=756763
|
|
|
|
|
|
|
| |
ASCII encode bytes sent to subprocess.stdin.write to ensure
Python 2 and 3 compatibility.
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
|
|
|
|
|
|
| |
Use absolute_import to ensure Python 3 compatibility of the code base.
https://bugzilla.gnome.org/show_bug.cgi?id=679438
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add a preprocess() function in ccompiler.py so that it will call the
preprocess() method of the distutils.ccompiler class, and make use of it
from sourcescanner.py.
As we would need to set up the options (include paths, macros, undefs) to
pass into the preprocessor (and later for the compiler), we have a new
private function that translates what we have from the rest of giscanner so
that it could be passed to distutils.ccompiler in a way that it
understands.
Also, as the MSVCCompiler classes in distutils do not provide a
preprocess() implementation, we provide our own so that we can use it when
preprocessing, via distutils, through subclassing MSVCCompiler.
https://bugzilla.gnome.org/show_bug.cgi?id=728313
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
As we attempt to move giscanner to use distutils for preprocessing and
building the introspection dumper program, we need to update _parse(),
where the preprocessor is called, to not use stdin and stdout for the
preprocessor input and output, as distutils do not accept such usage.
The added bonus for this change is that MSVC builds can be done without
using MinGW/GCC as a helper, as the '-' flag for preprocessing from stdin
was the hindrance to that.
https://bugzilla.gnome.org/show_bug.cgi?id=728313
|
|
|
|
|
| |
Updated from:
https://raw.githubusercontent.com/jcrocholl/pep8/1.6.2/pep8.py
|
|
|
|
|
|
|
| |
These may cause cpp to output code that still has #defines in them,
which the scanner does not expect.
https://bugzilla.gnome.org/show_bug.cgi?id=720504
|
|
|
|
|
|
|
| |
In all of the places that we pass through the CFLAGS, we should be doing
the same with the CPPFLAGS.
https://bugzilla.gnome.org/show_bug.cgi?id=720063
|
|
|
|
|
|
|
|
| |
When doing the source scanning in giscanner, make sure we pass the
user's CFLAGS environment variable to the compiler, as we do for the
dumper.
https://bugzilla.gnome.org/show_bug.cgi?id=720063
|
|
|
|
|
|
|
|
| |
Aliasing TRUE or FALSE is not very common, but done occasionally
for extra clarity. Namely G_SOURCE_REMOVE / G_SOURCE_CONTINUE are
self-explanatory, unlike the "raw" booleans.
https://bugzilla.gnome.org/show_bug.cgi?id=719566
|
|
|
|
|
|
|
|
| |
Ensure we are using the real path also for cflags comming from
pkg_config files and command line options. This fixes the generation of
the gir files when include paths contain symlinks.
https://bugzilla.gnome.org/show_bug.cgi?id=712211
|
|
|
|
|
|
|
|
|
|
|
| |
giscannermodule expects file names to be canonicalized and
symlinks to be resolved (most likely to support users of
symlinked /usr/local). Instead of computing absolute and real
paths all over the place, we can do this once on entry
in SourceScanner().parse_files() and SourceScanner().parse_macros()
and clean the rest a bit...
https://bugzilla.gnome.org/show_bug.cgi?id=710320
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Version in our tree is a wee bit outdated. For example,
later work will introduce an utf8 encoded python source
file which our old pep8.py does not yet understand (yeah,
it really was *that* ancient)...
Updated from:
https://raw.github.com/jcrocholl/pep8/1.4.5/pep8.py
Takes 552c1f1525e37a30376790151c1ba437776682c5,
f941537d1c0a40f0906490ed160db6c79af572d3,
5a4afe2a77d0ff7d9fea13dd93c3304a6ca993de and
a17f157e19bd6792c00321c8020dca5e5a281f45 into account...
https://bugzilla.gnome.org/show_bug.cgi?id=699535
|
|
|
|
|
|
| |
No need for two variables...
https://bugzilla.gnome.org/show_bug.cgi?id=699533
|
|
|
|
|
|
|
| |
Enables us to to use a more effecient list membership test
instead of testing the end of some string multiple times.
https://bugzilla.gnome.org/show_bug.cgi?id=699533
|
|
|
|
|
|
| |
mktemp was deprecated in Python 2.3...
https://bugzilla.gnome.org/show_bug.cgi?id=697624
|
|
|
|
|
|
|
|
|
| |
Newer spidermonkey .pc file contains a -include argument, which
g-ir-scanner doesn't understand. Rather than us attempting to replicate
all of cpp's options, use wrapper arguments in Makefile.introspection
to pass them through.
https://bugzilla.gnome.org/show_bug.cgi?id=695182
|
|
|
|
|
|
| |
Doesn't work with arguments that have shell quotes.
This reverts commit 95b03cf87efbd4fea4b7d55601c9752cefd29bfc.
|
|
|
|
|
|
|
|
| |
gi-r-scanner chokes when gir_CFLAGS have an '-include <header>' since
this is not a recognised option. This commit adds a new --cflags option
that passes cflags directly to the spawned gcc.
https://bugzilla.gnome.org/show_bug.cgi?id=695182
|
|
|
|
|
|
|
|
|
|
|
| |
Since the Visual C++ (cl.exe) preprocessor does not accept source input
from stdin (the '-' preprocessor flag, we need to use the GCC preprocessor
as a helper here.
Note that the generated dumper program is still compiled and run by
Visual C++.
https://bugzilla.gnome.org/show_bug.cgi?id=681820
|
|
|
|
|
| |
This avoids a bit of python work and reduces the
amount of allocations.
|
|
|
|
|
| |
Only parse doc comments for the files we pass in
on the command line to g-ir-scanner, not the included dependencies.
|
|
|
|
|
|
|
|
| |
This fixes compilation where CC="ccache gcc" and similar.
https://bugzilla.gnome.org/show_bug.cgi?id=660160
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
|
| |
|
|
|
|
|
| |
This is cleaner and faster, and prepares us better for an incoming
import of CMPH.
|
|
|
|
| |
https://bugzilla.gnome.org/show_bug.cgi?id=630101
|
|
|
|
| |
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=594125
|
|
|
|
|
|
| |
Add a position class which will make it easier to
send filename/line/column information to the message
class.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
One of the first big changes in this rewrite is changing the Type
object to have separate target_fundamental and target_giname properties,
rather than just being strings. Previously in the scanner, it was
awful because we used heuristics around strings.
The ast.py is refactored so that not everything is a Node - that
was a rather useless abstraction. Now, only things which can have
a GIName are Node. E.g. Type and Field are no longer Node.
More things were merged from glibast.py into ast.py, since it isn't
a very useful split.
transformer.py gains more intelligence and will e.g. turn GLib.List
into a List() object earlier. The namespace processing is a lot
cleaner now; since we parse the included .girs, we know the C
prefix for each namespace, and have functions to parse both
C type names (GtkFooBar) and symbols gtk_foo_bar into their
symbols cleanly. Type resolution is much, much saner because
we know Type(target_giname=Gtk.Foo) maps to the namespace Gtk.
glibtransformer.py now just handles the XML processing from the dump,
and a few miscellaneous things.
The major heavy lifting now lives in primarytransformer.py, which
is a combination of most of annotationparser.py and half of
glibtransformer.py.
annotationparser.py now literally just parses annotations; it's
no longer in the business of e.g. guessing transfer too.
finaltransformer.py is a new file which does post-analysis for
"introspectability" mainly.
girparser.c is fixed for some introspectable=0 processing.
|
|
|
|
|
|
|
|
| |
This is to support cases such as WebKitGTK+, that have C API
implemented in C++ files. Do note this does not mean we support proper
C++ parsing.
https://bugzilla.gnome.org/show_bug.cgi?id=627152
|
|
|
|
| |
https://bugzilla.gnome.org/show_bug.cgi?id=618562
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This work allows us to move closer to replacing gtk-doc, among other
things. We add a generic attribute "introspectable", and inside the
typelib compiler if we see "introspectable=no", we don't put it in the
typelib. This replaces the hackish pre-filter for varargs with a much
more generic mechanism.
The varargs is now handled in the scanner, and we emit
introspectable=no for them.
Add generic metadata to Node with references to file/line/column,
which currently comes from symbols.
Add scanner options --warn-all and --warn-error.
https://bugzilla.gnome.org/show_bug.cgi?id=621570
|
|
|
|
| |
This reverts commit 074192b89c6afcdd7f062f03989972e44334b8bf.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This work allows us to move closer to replacing gtk-doc, among other
things. We add a generic attribute "introspectable", and inside the
typelib compiler if we see "introspectable=no", we don't put it in the
typelib. This replaces the hackish pre-filter for varargs with a much
more generic mechanism.
The varargs is now handled in the scanner, and we emit
introspectable=no for them.
Add generic metadata to Node with references to file/line/column,
which currently comes from symbols.
Add scanner options --Wall and --Werror.
|