summaryrefslogtreecommitdiff
path: root/giscanner/utils.py
Commit message (Collapse)AuthorAgeFilesLines
* scanner: Add various static debug hooks in GI_SCANNER_DEBUGColin Walters2010-09-071-0/+21
| | | | | | | For backwards compat, keep the presence of the environment variable at all to mean "exception". Also start a HACKING file.
* Major rewriteColin Walters2010-08-311-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* [giscanner] Catch CalledProcessError and OSErrorJohan Dahlin2010-02-171-1/+1
| | | | | Instead of catching all errors, including AttributeError, TypeError and NameError.
* [scanner] Catch OSError too when checking for libtoolColin Walters2010-02-171-1/+1
| | | | | | If we don't have permission to execute the libtool binary, we'd just throw here which is wrong. Fix this by catching all exceptions.
* Bug 592055 - Build/test fixesColin Walters2009-08-171-1/+2
| | | | The last few commits regressed 'check'; fix those up.
* Support passing --library=lib<foo>.laOwen W. Taylor2009-08-171-5/+27
| | | | | | | | | | | | | | | | In addition to the current --library=<foo>, support --library=lib<foo>.la. This makes it unambiguous that we are referencing an uninstalled library and allows accurate extraction of the shared library name for the uninstalled library. * tests/scanner/Makefile.am tests/offsets/Makefile.am: Use the new form of --library=. Also some LD_LIBRARY_PATH frobbing as needed. *-expected.gir *-expected.tgir: We now pick out the shared library accurately, so fix shared-library="" in our reference girs. (The comparison may need some pre-sanitization now to work on non-ELF) http://bugzilla.gnome.org/show_bug.cgi?id=591669
* Resolve library names to shared libraries ourselvesOwen W. Taylor2009-08-171-0/+22
| | | | | | | | | | | | | | | | | | | | | 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 575613 - Enum stripping with common prefix, also use "_" consistentlyColin Walters2009-03-171-11/+0
| | | | | | | | | | | | | Some enums have members which have a common prefix which doesn't match that of the enum name, but it also longer than the global namespace prefix. Instead, try stripping the common prefix first, and only if that fails fall back to the global strip. Also, for glib-registered enums we were using the nick, which typically has "-" as a separator. Replace that with "_" for consistency between unregistered enums and registered. utils.py:strip_common_prefix is now unused, delete.
* Relicense the giscanner library under LGPLv2+. This has been approved byJohan Dahlin2008-11-041-11/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2008-11-04 Johan Dahlin <jdahlin@async.com.br> * giscanner/__init__.py: * giscanner/ast.py: * giscanner/cachestore.py: * giscanner/cgobject.py: * giscanner/girparser.py: * giscanner/girwriter.py: * giscanner/giscannermodule.c: * giscanner/glibast.py: * giscanner/glibtransformer.py: * giscanner/libtoolimporter.py: * giscanner/minixpath.py: * giscanner/odict.py: * giscanner/sourcescanner.c: * giscanner/sourcescanner.h: * giscanner/sourcescanner.py: * giscanner/transformer.py: * giscanner/utils.py: * giscanner/xmlwriter.py: * COPYING: Relicense the giscanner library under LGPLv2+. This has been approved by all contributors. svn path=/trunk/; revision=862
* Bug 556358 - don't use libtool internalsJohan Dahlin2008-10-211-0/+4
| | | | | | | | | | | | | | | 2008-10-21 Johan Dahlin <johan@gnome.org> Bug 556358 - don't use libtool internals * giscanner/Makefile.am: * giscanner/libtoolimporter.py: * giscanner/sourcescanner.py: * giscanner/utils.py: Add a python meta importer and remove a libtool symlink hack. svn path=/trunk/; revision=767
* Bug 552376: scanner generates wrong names for enum members when there's noLucas Rocha2008-10-111-1/+4
| | | | | | | | | | | | | | | | 2008-10-11 Lucas Rocha <lucasr@gnome.org> Bug 552376: scanner generates wrong names for enum members when there's no defined gtype. * giscanner/utils.py (strip_common_prefix): Always strip common prefix exactly up to the last "_", and not beyond. * tests/scanner/foo.h (FooEnumNoType): add FOO_ENUM_NEUF. The point here is that the first character after the last '_' should should be the same as the character in the same position on the type name. * tests/scanner/foo-expected.gir: test that svn path=/trunk/; revision=664
* Bug 554521: scanner generates wrong names for enum members withDan Winship2008-10-021-2/+2
| | | | | | | | | | | | | full type name prefix * giscanner/utils.py (strip_common_prefix): Fix this to strip the right amount when the entire "first" string is a prefix of "second" * tests/scanner/foo.h (FooEnumFullname): * tests/scanner/foo-expected.gir: test that svn path=/trunk/; revision=640
* Bug 552390: Handle capitialization like "DBus" more robustlyColin Walters2008-09-201-0/+7
| | | | | | | | The to_underscores function was designed for use against prefixed names; we need a separate function which will convert names like DBusFoo into dbus_foo, not d_bus_foo. svn path=/trunk/; revision=621
* Fix up strip logic to not regressJohan Dahlin2008-08-311-1/+1
| | | | svn path=/trunk/; revision=555
* Clean up a huge if. Do not add methods or constructors to enums/flags.Johan Dahlin2008-08-311-1/+1
| | | | | | | | | | | | | 2008-08-31 Johan Dahlin <johan@gnome.org> * giscanner/glibtransformer.py: Clean up a huge if. Do not add methods or constructors to enums/flags. * giscanner/utils.py: second might be longer than first, check that. svn path=/trunk/; revision=550
* Much simpler approach of mapping uscored names to classes. RemoveColin Walters2008-08-211-17/+0
| | | | | | | | | | 2008-08-21 Colin Walters <walters@verbum.org> * giscanner/glibtransformer.py: Much simpler approach of mapping uscored names to classes. * giscanner/utils.py: Remove unnecessary function. svn path=/trunk/; revision=443
* Look up all permutations of class names when scanning methods/ctors basedColin Walters2008-08-211-0/+18
| | | | | | | | | | | 2008-08-21 Colin Walters <walters@verbum.org> * giscanner/glibtransformer.py: Look up all permutations of class names when scanning methods/ctors based on the prefix instead of using the return value. This associates gtk_window_new with the right class. svn path=/trunk/; revision=442
* Set ctype of enums Improve enum parsing for enums without a GType. MakeJohan Dahlin2008-08-181-2/+2
| | | | | | | | | | | | | | | | | | | | | 2008-08-18 Johan Dahlin <johan@gnome.org> * gir/Makefile.am: * giscanner/girparser.py: Set ctype of enums * giscanner/transformer.py: Improve enum parsing for enums without a GType. Make flags/enum references to other girs work * giscanner/utils.py: Simplify this a bit * tests/scanner/Makefile.am: * tests/scanner/foo-object.h: * tests/scanner/utility-expected.gir: * tests/scanner/utility.h: Add a new test for external enum references svn path=/trunk/; revision=397
* Refactor a bit, avoid isinstance and add a method for each type we parse.Johan Dahlin2008-08-141-1/+1
| | | | | | | | | | | | 2008-08-14 Johan Dahlin <johan@gnome.org> * giscanner/glibtransformer.py: * giscanner/utils.py: Refactor a bit, avoid isinstance and add a method for each type we parse. svn path=/trunk/; revision=367
* PEP8ifyJohan Dahlin2008-08-091-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | 2008-08-09 Johan Dahlin <johan@gnome.org> * giscanner/__init__.py: * giscanner/ast.py: * giscanner/cgobject.py: * giscanner/gidlparser.py: * giscanner/gidlwriter.py: * giscanner/girparser.py: * giscanner/girwriter.py: * giscanner/glibast.py: * giscanner/glibtransformer.py: * giscanner/odict.py: * giscanner/sourcescanner.py: * giscanner/transformer.py: * giscanner/utils.py: * giscanner/xmlwriter.py: * tools/g-ir-scanner: PEP8ify svn path=/trunk/; revision=341
* Improve enum member parsing and introspectionJohan Dahlin2008-06-031-0/+53
2008-06-03 Johan Dahlin <jdahlin@async.com.br> * giscanner/Makefile.am: * giscanner/ast.py: * giscanner/girwriter.py: * giscanner/glibast.py: * giscanner/glibtransformer.py: * giscanner/transformer.py: * giscanner/utils.py: * tests/parser/Foo-expected.gir: Improve enum member parsing and introspection svn path=/trunk/; revision=283