summaryrefslogtreecommitdiff
path: root/giscanner/message.py
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* message: handle fatal errors even if warnings are disabled. Fixes #229Christoph Reiter2019-01-101-1/+1
|
* message: simplify handling of error levelsChristoph Reiter2019-01-101-9/+4
| | | | | | | | Instead of allowing each error level to be enabled just enable all of them through the enable_warnings() method. This matches what the code is currently doing (minus that one helper script) and simplifies things. Also remove the error count, it's not used.
* Clean shebangs out of non-executable scripts and drop exec perm from ↵Dominique Leuenberger2019-01-091-1/+0
| | | | xmlwriter.py
* Drop all Python 2 compat codeChristoph Reiter2018-12-081-5/+0
| | | | We only support 3.4+ now.
* writer: Include documentation and symbol position in source filesThibault Saunier2018-11-281-2/+3
| | | | | | | | | | | Some documentation tool (as hotdoc[0]) need to have information about symbol declaration and documentation positions in the source files to be able to do smart indexing (automatically build the documenation index). [0] https://hotdoc.github.io/ Fixes #175
* giscanner: Print relative filename paths when warningJonas Ådahl2018-11-081-5/+2
| | | | | | | | | | | | | | | | g-ir-scanner would cut away the 'common prefix' between the current working directory and the file about be warned about. This is problematic when using automatic jumping to warnings and errors, as it'd mean the editor can't find the relevant file. For example, if g-ir-scanner is run from 'build/', and a warning occurs on a file in 'src/file.c', the scanner would print the warning 'src/file.c:123: Warning: This and that'. Running this from e.g. meson would mean e.g. VIM would not find the correct file to jump to. Meanwhile, GCC, in the same setup, would print '../src/file.c:123: Warning: ...', as that is the relative path from where the scanner is ran, and e.g. VIM would behave in a correct way.
* giscanner.message: Don't print node as the default contextMikhail Zabaluev2015-10-051-3/+1
| | | | | | | Node is always present in the output of .log_node(), so printing it another time as context just adds noise. https://bugzilla.gnome.org/show_bug.cgi?id=756088
* giscanner.message: Fix module-level logging functionsMikhail Zabaluev2015-09-301-3/+7
| | | | | | | | MessageLogger.get() calls the class constructor without arguments. The __init__ signature, however, did not default the namespace parameter, so any usage of the logging functions caused a bogus exception. https://bugzilla.gnome.org/show_bug.cgi?id=755890
* scanner: Pacify PEP8Colin Walters2015-09-291-0/+2
|
* giscanner: Use rich comparison methods for Python 3 compatibilitySimon Feltman2015-09-291-4/+27
| | | | | | | | | | Add lt, le, gt, ge, eq, ne, and hash dunder methods to all classes that implement custom comparisons with __cmp__. This is needed to support Python 3 compatible sorting of instances of these classes. Avoid using @functools.total_ordering which does not work for some of these classes and also is not available in Python 2.6. https://bugzilla.gnome.org/show_bug.cgi?id=679438
* 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-1/+1
| | | | | | | | | | | 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
* scanner: Explicitly error with constructors but no GObject includeColin Walters2015-09-291-0/+2
| | | | | One of the Anaconda developers hit this; the fix was to include GObject, but without this commit we just traceback'd.
* tests: Update misc/pep8.py to 1.6.2Dieter Verfaillie2015-06-291-1/+1
| | | | | Updated from: https://raw.githubusercontent.com/jcrocholl/pep8/1.6.2/pep8.py
* scanner: centralize caret error message handlingDieter Verfaillie2015-06-241-7/+10
| | | | | | | Not doing this manually all over the place makes the code slightly more readable. https://bugzilla.gnome.org/show_bug.cgi?id=689454
* giscanner: give message.ERROR a purposeDieter Verfaillie2013-10-081-18/+31
| | | | | | | | | | | | | | | | | | | It's not yet being used but will be in the future by annotationparser.py to signal the difference between message.WARNING: something is wrong but the comment block can still be parsed and serialized back into a comment block without information being lost message.ERROR: something is wrong and the comment block can *not* be parsed and serialized back into a comment block without information being lost Different tools can then act accordingly. Nothing will change for g-ir-scanner but this will be important for the GTK-Doc comment block rewriting tool to prevent extremely broken input leading to even more broken output...
* giscanner: remove Position.offset()Dieter Verfaillie2013-10-081-3/+0
| | | | It's never used...
* giscanner: give pointer to original comment block...Dieter Verfaillie2013-10-081-4/+7
| | | | | ...when complaining about multiple comment blocks documenting the same identifier.
* giscanner: define __slots__ on some classesDieter Verfaillie2013-10-081-0/+3
| | | | | | For example, when creating Gtk-3.0.gir, thousands of instances of these classes get created. This makes us waste less space for these instances by not having their __dict__ being created.
* tests: Update misc/pep8.py to 1.4.5Dieter Verfaillie2013-05-071-8/+10
| | | | | | | | | | | | | | | | | 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
* Now make AnnotationParser do what gobject-introspection needs it to do.Dieter Verfaillie2012-04-051-2/+6
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=672254
* message: Show the file/line even when processing FATALColin Walters2011-10-171-5/+5
| | | | This helps debug. Also, add a 'fatal' debug break.
* scanner: Print out a message if warnings were offColin Walters2010-10-251-5/+5
| | | | | | Otherwise people may not know about --warn-all. https://bugzilla.gnome.org/show_bug.cgi?id=631644
* scanner: Don't duplicate fatal message textColin Walters2010-09-291-1/+2
|
* [Message] Implement Position.__repr__Johan Dahlin2010-09-201-0/+6
|
* [message] Add apositions argument to a few functionsJohan Dahlin2010-09-201-6/+8
|
* [scanner] Add a Position classJohan Dahlin2010-09-201-47/+56
| | | | | | Add a position class which will make it easier to send filename/line/column information to the message class.
* [message] Set file_positions to an empty listJohan Dahlin2010-09-201-1/+1
| | | | | | So we can always pass it into len() without breaking https://bugzilla.gnome.org/show_bug.cgi?id=629959
* [scanner] Make fatal warnings exitJohan Dahlin2010-09-071-4/+6
| | | | Even if warnings are not enabled
* scanner: Add various static debug hooks in GI_SCANNER_DEBUGColin Walters2010-09-071-0/+3
| | | | | | | For backwards compat, keep the presence of the environment variable at all to mean "exception". Also start a HACKING file.
* scanner: Actually exit with code 1 on fatal warnings againColin Walters2010-09-031-1/+1
|
* [message] exit after calling message.fatal()Johan Dahlin2010-09-021-1/+1
|
* [message] Add an output parameterJohan Dahlin2010-09-021-7/+10
|
* [scanner] add a message moduleJohan Dahlin2010-09-021-0/+155
This module will be used to report warnings, which doesn't explicitly depend on the transformer instance.