summaryrefslogtreecommitdiff
path: root/giscanner/scannermain.py
Commit message (Collapse)AuthorAgeFilesLines
* scanner: Print out a message if warnings were offColin Walters2010-10-251-1/+5
| | | | | | Otherwise people may not know about --warn-all. https://bugzilla.gnome.org/show_bug.cgi?id=631644
* scanner: Don't process pkg-config libs twiceColin Walters2010-10-191-10/+0
| | | | | | | | | | | | Before, we were adding the --libs-only-L from pkg-config files during initial scanning, as if --library-path was specified, *and* inside the dumper, we used --libs. Fix this by always doing -L. <introspected libraries> <pkg-config libs> This should ensure we don't duplicate the search path anyways. https://bugzilla.gnome.org/show_bug.cgi?id=631348
* [scannermain] Split scanner_main into smaller piecesJohan Dahlin2010-09-241-89/+115
| | | | | Split it into pieces that will be reusable across different command line tools.
* Pass in blocks to IntrospectablePassJohan Dahlin2010-09-201-1/+1
|
* [scanner] Only store types in cache storeJohan Dahlin2010-09-201-0/+4
| | | | | | | | | | | | Only store types that can be referenced in the cache store this reduces the size of the serialized Gtk-3.0.gir in the store from 5.7M to 366k on my system. It also reduces the time it takes to create a gir in gtksourceview by 35% and the time to run the warnings test by more than 50% This also disables the cache for passthrough mode since it needs access to the whole serialized tree.
* scanner: Readd support for --strip-prefixColin Walters2010-09-101-2/+3
| | | | | | We still really do want people to port to --identifier-prefix (and --symbol-prefix if necessary) because there's no ambiguity. Before the way we were casefolding was just a terrible mess.
* scanner: Fix style for previous commitColin Walters2010-09-091-3/+4
|
* Print helpful error message if --strip-prefix option is used.Saikiran Madugula2010-09-091-0/+7
|
* Handle casing better for constantsOwen W. Taylor2010-09-071-0/+5
| | | | | | | | | | | | | | | | | Instead of handling constants by lower-casing them, stripping the lower-case prefix and upper-casing them again, leave them in the original case and check against upper-cased versions of namespace.symbol_prefixes. Wwe detect what version to test against by looking at the first character of the identifier, so we assume that --symbol-prefix options are always in lowercase. If that needs to be relaxed, then we'll have to check all symbols against both sets of prefixes. Add tests for constants to Regress.h and fix tests/warn/unresolved-type.h for a warning message that improved with this change. https://bugzilla.gnome.org/show_bug.cgi?id=629007
* scanner: Add various static debug hooks in GI_SCANNER_DEBUGColin Walters2010-09-071-2/+4
| | | | | | | For backwards compat, keep the presence of the environment variable at all to mean "exception". Also start a HACKING file.
* [scannermain] Use mkstempJohan Dahlin2010-09-021-8/+10
| | | | | Since the delete parameter of NamedTemporaryFile is only available on python 2.6
* [giscanner] Make pyflakes happyJohan Dahlin2010-09-021-2/+3
|
* scanner: Add --include-uninstalledColin Walters2010-09-021-1/+7
| | | | | | | | We need a way to add a .gir file, without also attempting to load the pkg-config file for it (since it may not be installed yet). Example: clutter builds multiple .gir files, Cally-1.0 depends on Clutter-1.0.
* [scannermain] Create a new option parserJohan Dahlin2010-09-021-2/+3
| | | | Create a new option parser when parsing pkg-config output
* [scanner] Remove old logging functionsJohan Dahlin2010-09-021-3/+4
| | | | And migrate over to using the message logger
* [scanner] Move over remaining callsites to messageJohan Dahlin2010-09-021-2/+2
| | | | | Move the remaining callsites over to the new message module
* [scanner] add a message moduleJohan Dahlin2010-09-021-2/+3
| | | | | This module will be used to report warnings, which doesn't explicitly depend on the transformer instance.
* [scanner] Move namespace out of TransformerJohan Dahlin2010-09-021-5/+6
|
* [transformer] Don't pass around source scannerJohan Dahlin2010-09-021-1/+1
| | | | Pass around its symbols instead
* [annotationparser] Send in comments directlyJohan Dahlin2010-09-021-2/+2
|
* [scanner] Create the cachestore in the transformerJohan Dahlin2010-09-021-4/+1
|
* [scanner] Remove support for xpath assertionsJohan Dahlin2010-09-011-19/+0
| | | | It has been broken for a while and nobody uses it.
* [scannermain] Hide a couple of private optionsJohan Dahlin2010-09-011-12/+14
|
* [scannermain] Use _error() consistentlyJohan Dahlin2010-09-011-6/+5
|
* [scannermain] Simplify writing of output dataJohan Dahlin2010-09-011-15/+24
| | | | | Make the common case (no validation) much simple and add error checking while writing the output
* [scannermain] Use return instead of sys.exit()Johan Dahlin2010-09-011-7/+8
|
* [scannermain] Use shutil.move instead of os.renameJohan Dahlin2010-09-011-2/+10
| | | | | In case that the temporary directory and the output directory is not on the same filesystem.
* [scannermain] Write to tempdir if neededJohan Dahlin2010-09-011-0/+2
| | | | | | If the current directory is not writable nor if the directory of the output file isn't, use the standard temporayr directory as a last resort.
* [scannermain] Add - as an alias for stdoutJohan Dahlin2010-09-011-1/+1
|
* [scannermain] Sort imports alphabeticallyJohan Dahlin2010-09-011-6/+6
|
* scanner: Refactor name parsingColin Walters2010-09-011-1/+2
| | | | | | | | | | | | | | First, merge the implementations of parsing both identifiers and symbols, since they had more in common than they had differences. Secondly, fix the logic for priority of --accept-unprefixed in the presence of unprefixed includes. The current namespace should win. An example of this is mutter which has unprefixed public symbols, but also includes xlib, which has no prefix. Third, for unprefixed namespaces, actually look at the contents rather than just blindly returning them. This is a bit of a hack, but better than the alternatives.
* scanner: Add --accept-unprefixedColin Walters2010-09-011-2/+6
| | | | This is necessary for Mutter right now.
* scanner: Better handling of empty namespace prefix for XColin Walters2010-08-311-2/+14
| | | | | Add namespacing prefixes to the static .gir files. Support the empty prefix, as is needed for xlib.
* Major rewriteColin Walters2010-08-311-89/+80
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* [scanner] Also parse C++ filesGustavo Noronha Silva2010-08-171-2/+6
| | | | | | | | 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
* In verbose mode, print out the dump compilationColin Walters2010-07-071-0/+5
| | | | | | | | | | | | When debugging the dumper, it's extremely useful to be able to see the argument it's passing to the compiler/linker. This patch makes g-ir-scanner work the same way as libtool basically; we default to printing out stuff, and add a --quiet option. The Makefile.introspection handles passing --quiet automatically. https://bugzilla.gnome.org/show_bug.cgi?id=622751
* Support introspectable=no attribute, add warnings frameworkColin Walters2010-06-171-0/+13
| | | | | | | | | | | | | | | | | | 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
* Revert "Support introspectable=no attribute, add warnings framework"Johan Dahlin2010-06-171-13/+0
| | | | This reverts commit 074192b89c6afcdd7f062f03989972e44334b8bf.
* Support introspectable=no attribute, add warnings frameworkColin Walters2010-06-161-0/+13
| | | | | | | | | | | | | | | | 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.
* [scanner] Print error instead of throwing for unknown includeColin Walters2010-02-111-1/+5
| | | | We should avoid exceptions being propagated to the toplevel.
* Add an --add-init-section argumentDamien Lespiau2010-01-051-0/+3
| | | | | | | | | | One might need to call some init functions before being able to call get_type() to create the types of a library. --add-init-section let the user insert some initialization code in the introspection program. https://bugzilla.gnome.org/show_bug.cgi?id=605778
* Fix typo in the help string of the --no-libtool argumentDamien Lespiau2009-12-311-1/+1
| | | | | | | --no-libtool means that one does not want to use libtool to compile the introspection program. https://bugzilla.gnome.org/show_bug.cgi?id=605774
* Bug 574351 - Add --pkg-export optionGOBJECT_INTROSPECTION_0_6_4Colin Walters2009-08-241-1/+8
| | | | | | | | | We need to differentiate between --pkg options we use to parse ourself, and --pkg-export which are needed for library consumers. When introspecting a library we won't necessarily have the pkg-config file built, so add a --pkg-export line so library authors can explicitly make the .gir -> pkg-config association.
* LD_LIBRARY_PATH exorcismColin Walters2009-08-241-14/+0
| | | | | | | | | | | | | | | Thanks to commit 6d510b8db, we now no longer need LD_LIBRARY_PATH to be set for invoking the compiler. Next, before we were taking the LD_LIBRARY_PATH variable and turning it into a compile path, presumably to attempt to handle the cases where we weren't getting the right -L flags. Also interacting with this was a while ago we weren't really doing uninstalled libtool libraries correctly, which is probably how hacks involving LD_LIBRARY_PATH crept into the scanner. Just require that we're passed the right -L flags, and we should be doing libtool libraries better now.
* Resolve library names to shared libraries ourselvesOwen W. Taylor2009-08-171-1/+4
| | | | | | | | | | | | | | | | | | | | | Using ctypes.util.find_library() to resolve library names to sonames causes problems with dealing with uninstalled libtool operation properly. We're unlikely to find any way of combining the two that will be robust against future changes in both facilities. Switch to a different approach - run 'ldd' on the compiled introspection binary and extract sonames from there This is less portable but should be quite robust where it works. utils.py dumper.py: Move libtool-command-line finding into utils.py girwriter.py: Remove library name resolution from here, expect libraries to be passed in preresolved. shlibs.py scannermain.py: New file including resolve_shlibs() to resolve library names using the introspection binary. tests/scanner/Makefile.am: Add .libs to LD_LIBRARY_PATH http://bugzilla.gnome.org/show_bug.cgi?id=591669
* Bug 564016 - Add c:prefix to .girColin Walters2009-03-171-1/+2
| | | | | | | This has a few use cases; the main one in mind right now is that when we place this in the .typelib as well, we can use it to optimize lookups based on GType names, by skipping entirely typelibs whose c:prefix is not a prefix of the target type lookup.
* Bug 574501 - Install giscanner Python module to private directoryColin Walters2009-03-161-0/+342
We don't want to pollute the global namespace with our private libraries. Also, this sidesteps all the craziness that is happening with OS vendors changing how Python installs modules.