summaryrefslogtreecommitdiff
path: root/giscanner/gdumpparser.py
Commit message (Collapse)AuthorAgeFilesLines
* Add glib:name to enum memberMarc-André Lureau2021-06-201-1/+2
| | | | | | | 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>
* Always pass an encoding to open() using text modeChristoph Reiter2020-11-071-1/+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.
* Replace calls to deprecated xml.etree.cElementTreeStephen Gallagher2020-03-261-1/+1
| | | | | | | | | 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>
* Revert "Restore original meaning of disguised attribute."Christoph Reiter2019-01-161-0/+4
| | | | | | This reverts commit f606183a010fbec4382acb728882cc0eddbaf7f7. See https://gitlab.gnome.org/GNOME/gobject-introspection/merge_requests/9#note_409979
* Restore original meaning of disguised attribute.Tomasz Miąsko2019-01-101-4/+0
| | | | | | | | | | | | | | | | > Certain types like GIConv and GdkAtom are pointers internally but don't > look like pointers when referenced. They have the form. > > typedef struct _X *X; > > Parse these as structures/records but mark them in the gir with a 'disguised' > attribute so that we know that they need special handling. Additionally, stop relaying on disguised attribute when deciding whether to render a page. Check number of fields instead, so as to avoid introducing large regression in the docs. Fixes #101.
* Drop all Python 2 compat codeChristoph Reiter2018-12-081-5/+0
| | | | We only support 3.4+ now.
* Add utils.rmtree() which waits and tries again if a file is still in useChristoph Reiter2018-06-201-2/+1
| | | | | | | | | | | | | | | On Windows the dumper cleanup regularely fails because the created .exe is still in use by some process and shutil.rmtree() fails with: OSError: [WinError 145] The directory is not empty I'm not 100% sure what's the cause for this, but searching for similar issues suggests that it might be Windows Defender scanning the newly created .exe file and because it's so short lifed the scanning and deleting conflict. This adds a helper which tries a few times and waits a bit before giving up. A similar patch has been in MSYS2 for some time: https://github.com/Alexpux/MINGW-packages/blob/d0c39af02a669e45272c713e912ee63b0dd94157/mingw-w64-gobject-introspection/0025-more-tolerant-rmtreeing.patch
* giscanner: Remove custom collections implementationNirbheek Chauhan2018-03-101-3/+3
| | | | | | | We already require python 2.7, and it has OrderedDict and Counter. Besides cleaning up unmaintained code, this change found and fixed a Python 3 bug where we were iterating over a dict while changing it.
* Use a launcher for executing g-ir-scannerNicola Fontana2016-02-161-0/+6
| | | | | | | | In cross-compilation the build system is unable to execute the compiled binary. Give the possibility to use a launcher, e.g. wine for MinGW or qemu for different CPU type. https://bugzilla.gnome.org/show_bug.cgi?id=696773
* giscanner: Use unicode literals in all Python filesSimon Feltman2015-09-291-0/+1
| | | | | | | | | | | | 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
* giscanner: Replace repr format usage with string formatterSimon Feltman2015-09-291-2/+2
| | | | | | | | | | | 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
* giscanner: Use print as a function for Python 3 compatibilitySimon Feltman2015-09-291-0/+1
| | | | | | | 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
* giscanner: Enable "true division" for all Python filesSimon Feltman2015-09-291-0/+1
| | | | | | | | | | 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
* giscanner: Use absolute_import for all Python filesSimon Feltman2015-09-291-0/+2
| | | | | | Use absolute_import to ensure Python 3 compatibility of the code base. https://bugzilla.gnome.org/show_bug.cgi?id=679438
* giscanner: Use items() instead of iteritems()Simon Feltman2015-09-291-5/+5
| | | | | | | Replace usage of iteritems() and itervalues() with items() and values() respectively. https://bugzilla.gnome.org/show_bug.cgi?id=679438
* giscanner: Convert map() results to listSimon Feltman2015-09-291-2/+2
| | | | | | | | Convert the results map() calls to a list for Python 3 compatibility. In Python 3, map() returns an iterable "map object" which does not allow indexing or iteration more than once. https://bugzilla.gnome.org/show_bug.cgi?id=679438
* scanner: use open() as os.fdopen as context managersDieter Verfaillie2015-08-211-10/+9
| | | | | | Ensures files are correctly and immediately closed. https://bugzilla.gnome.org/show_bug.cgi?id=751926
* tests: Update misc/pep8.py to 1.6.2Dieter Verfaillie2015-06-291-2/+2
| | | | | Updated from: https://raw.githubusercontent.com/jcrocholl/pep8/1.6.2/pep8.py
* scanner: Replace GInitiallyUnowned field sharing with generic solutionSimon Feltman2014-01-041-11/+0
| | | | | | | | | | | | Remove GInitiallyUnowned special case in gdumpparser where fields are copied from GObject. Add generic solution where anytime we have multiple typedef structs, the fields become shared: typedef struct _Foo Foo; typedef struct _Foo Bar; struct _Foo {...}; https://bugzilla.gnome.org/show_bug.cgi?id=581525
* giscanner: fix typoDieter Verfaillie2013-10-081-1/+1
|
* giscanner: remove dead codeDieter Verfaillie2013-10-081-8/+0
| | | | | Last call sites where removed in 36aa515f1036978ced8d4ffb808260844f7229e0 about 3 years ago.
* tests: Update misc/pep8.py to 1.4.5Dieter Verfaillie2013-05-071-6/+3
| | | | | | | | | | | | | | | | | 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
* giscanner: prefer "except X as e" over "except X, e"Dieter Verfaillie2013-04-091-7/+7
| | | | | | It's more readable and as an added bonus Python 3 compatible. https://bugzilla.gnome.org/show_bug.cgi?id=697616
* Fix matching of methods named *_get_type()Matthew Booth2012-03-061-11/+5
| | | | | | | | | | | | | The code which heuristically turned functions into class methods would always ignore any function called *_get_type or *_get_gtype. However, the code which looked for GI metadata functions to execute them was much more comprehensive, checking not just the name, but also that it had no parameters and that it returned a GType. This change abstracts the more comprehensive check into the Function class, and uses the same check in both places. https://bugzilla.gnome.org/show_bug.cgi?id=671218
* scanner: Don't add redundant notify signalColin Walters2011-09-121-4/+0
| | | | It was actually introduced by e0fea819f0da1ca60cce3280e7e21f3d2955be3a
* scanner: Only add notify signal to Object, not ParamSpec etc.Colin Walters2011-09-121-3/+4
|
* scanner: Add "notify" signal to GObjectColin Walters2011-09-091-0/+3
| | | | | For gjs we want to switch to using introspection data for signals, and the "notify" signal being missing from GObject was a problem.
* Avoid most of the special-casing of GObject.Object in the scannerPavel Holejsovsky2011-08-281-48/+14
| | | | | | | | | There were some cases of handling GObject and GInitiallyUnowned which were not necessary. Removing special cases from them simplified code and as a bonus it added 'GObject::notify' signal into GIR, which was not there previously. https://bugzilla.gnome.org/show_bug.cgi?id=657446
* Properly handle GParamSpec and descendantsPavel Holejsovsky2011-08-251-6/+21
| | | | | | | GParamSpec is introspected as fundamental class, and all GObject classes derived from it (e.g. GParamSpecChar) are marked as such. https://bugzilla.gnome.org/show_bug.cgi?id=656440
* Make sure signal works when there isn't one specifiedJohan Dahlin2011-08-131-1/+1
|
* Add signal flagsJohan Dahlin2011-08-131-1/+8
| | | | | | This adds all GSignalFlags into the gir. https://bugzilla.gnome.org/show_bug.cgi?id=656457
* Switch to storing string form of error quarksDan Winship2011-08-121-6/+35
| | | | | | | | | | | | | | | | Instead of storing the name of the function to call to get the error quark, store the string form of the error quark, which we derive from the introspection binary during scanning. Update EnumBlob and GIEnumInfo to include the new information. This will allow determining a back-mapping from error quark to error domain without having to dlsym() and call all the known error quark functions. Based on earlier patches from Owen Taylor and Maxim Ermilov. https://bugzilla.gnome.org/show_bug.cgi?id=602516
* Reverting "Workaround for CairoRectangleInt exposed in Gdk-3.0.gir"Pavel Holejsovsky2011-07-291-5/+0
| | | | This was not meant to be pushed (yet). Sorry for confusion.
* Workaround for CairoRectangleInt exposed in Gdk-3.0.girPavel Holejsovsky2011-07-291-0/+5
| | | | | | | | | This is simple workaround which ignores CairoRectangleInt boxed type appearing as defined by libgdk, because libgdk simply aliases this gtype for GdkRectangle (as it also typedef's GdkRectangle to cairo_rectangle_int_t). https://bugzilla.gnome.org/show_bug.cgi?id=655423
* gdumpparser.py: Limit line length to 100Colin Walters2011-06-091-1/+3
|
* Rework how fundamental GObject types are introspectedGiovanni Campagna2011-06-081-21/+30
| | | | | | | | | | | Change the special code for handling GObject and GInitiallyUnowned so that it exposes GParamSpec as a class, and it allows GVariant to have a GType without using the deprecate g_variant_get_gtype. It is a sort of ABI break, in that new typelibs won't work with previous versions of libgirepository. https://bugzilla.gnome.org/show_bug.cgi?id=646635
* Add boxed types definition for GLibGiovanni Campagna2011-06-041-17/+5
| | | | | | | | | | Use the new glib-boxed.h header from gobject to pair structure definitions with boxed types in the GLib namespace, improving the introspection coverage and removing some hacks. Some fixes from Colin Walters <walters@verbum.org> https://bugzilla.gnome.org/show_bug.cgi?id=646635
* scanner: Support _get_gtype() as a GType creation suffixColin Walters2011-06-031-4/+7
| | | | | | Based on a patch by Giovanni Campagna <gcampagna@src.gnome.org> https://bugzilla.gnome.org/show_bug.cgi?id=646635
* scanner: Fix handling of property transferColin Walters2011-01-051-3/+1
| | | | | | * gdumpparser.py was incorrectly passing the ctype for transfer * Property constructor wasn't actually doing anything with passed transfer * Parse transfer-ownership in girparser
* Make sure we don't mark GInitiallyUnownedClass as disguisedTomeu Vizoso2010-12-061-0/+1
|
* Handle enumerations with the full range of signed and unsigned valuesOwen W. Taylor2010-11-011-7/+25
| | | | | | | | | | | | | The C compiler will pick an enumeration type that accomodates the specified values for the enumeration, so ignoring 64-bit enumerations, we can have enumeration values from MININT32 to MAXUINT32. To handle this properly: - Use gint64 for holding eumeration values when scanning - Add a 'unsigned_value' bit to ValueBlob so we can distinguish the int32 vs. uint32 cases in the typelib - Change the return value of g_value_info_get_value() to gint64. https://bugzilla.gnome.org/show_bug.cgi?id=629704
* scanner: Don't leave temporary directory around if we failColin Walters2010-10-071-1/+3
| | | | | ...by default. However, the GI_SCANNER_DEBUG=save-temps option helps for debugging.
* Set c_symbol_prefix in the GVariant special caseTomeu Vizoso2010-09-171-0/+1
|
* scanner: Add temporary workaround for GStreamerColin Walters2010-09-151-0/+2
| | | | | | | Also document/bug link the other workarounds; just made up a convention for ## WORKAROUND ## See: https://bugzilla.gnome.org/show_bug.cgi?id=550616
* scanner: Add GType for GVariantColin Walters2010-09-131-5/+10
| | | | This needs a manual override since GVariant is a fundamental.
* scanner: Bomb out more obviously if a namespace contains class name = namespaceColin Walters2010-09-131-0/+6
| | | | | If you pass --namespace=FooBar, and have a GObject named FooBar, we'd assert. Give the user an obvious error message.
* scanner: Allow gstreamer's GParamSpecMiniObject throughColin Walters2010-09-101-0/+13
| | | | | | | | It's wrong, but they can't change it now, so work around it here. https://bugzilla.gnome.org/show_bug.cgi?id=550616 https://bugzilla.gnome.org/show_bug.cgi?id=629306
* scanner: Kill glibastColin Walters2010-09-081-43/+67
| | | | | | | | | | | | It was a stupid abstraction split, we only support GObject. * Clean up how we handle c:type - we only set it if we've actually seen a corresponding structure. * Add a warning if we don't see the structure typedef for an interface, since that's pretty bogus. (And fix regress.h to have one) * Rename the "type_name" attribute internally to "gtype_name" for clarity.
* [scanner] Fundamental problems are not fatalJohan Dahlin2010-09-071-1/+2
|