| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
xmlwriter.py
|
|
|
|
| |
We only support 3.4+ now.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
| |
This reverts f345916405d94829696985 and related. The commit states that
both versions are about the same in performance, but the C version is more code and
harder to maintain. It also states that the behaviour re invalid control
characters is better with the C version which produces entities. But those
make any Python xml parser fail, which given that most of our tooling is Python,
doesn't seem better to me, see #135.
|
|
|
|
|
| |
There was a stray test() function already there. Move it to a unittest
file and run it with the other tests.
|
|
|
|
|
|
|
|
|
|
|
|
| |
Replace usage of the Python 2 cStringIO module with StringIO and
conditionally use io.StringIO for Python 3. This is needed to build
up a unicode version of the XML since cStringIO does not support
unicode. Add XMLWriter.get_encoded_xml() which returns a utf-8 encoded
bytes object of the XML data.
Open files for reading/writing in binary mode since we explicitly
encode and decode as utf-8.
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
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There's no sense in keeping it around as it is never
used. And even though measuring the time it takes to
build Gtk-3.0.gir using a) the C version and b) the
Python version reveals there is no measurable difference
to speak of (when *not* running under Python's cProfile
module):
With C collect_attributes:
==========================
real 0m30.614s
real 0m32.255s
real 0m31.034s
With Python collect_attributes:
===============================
real 0m31.530s
real 0m31.549s
real 0m31.673s
The C version ends up using g_markup_escape_text() which
will escape \004 as . Even though this is invalid
xml 1.0 (but valid xml 1.1), the Python version leaves
the \004 as is, which is even less desirable...
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
| |
line is a unicode() instance, xml.sax.saxutils.escape() does
nothing more than call a couple of replace() methods on said
unicode() instance so it makes little sense to encode line
into a str() and decode the escaped result back into a unicode().
https://bugzilla.gnome.org/show_bug.cgi?id=699533
|
| |
|
| |
|
|
|
|
|
|
| |
Coerce input temporarily inside xmlwriter into Unicode to do
string manipulation, and then only convert it to "UTF8str" when
writing into the data buffer.
|
|
|
|
|
|
| |
The assumption is that the only allowed source encoding
is utf-8. Always strings as unicode and fix up the transformer
and xml writer to properly output utf-8.
|
|
|
|
|
| |
This is cleaner and faster, and prepares us better for an incoming
import of CMPH.
|
| |
|
|
|
|
| |
https://bugzilla.gnome.org/show_bug.cgi?id=618562
|
|
|
|
|
|
|
|
|
| |
Moving to <doc> allows us to better preserve whitespace. XML has no
facility for whitespace-preserving attributes.
Second, for arrays and lists, both types with unknown element_type can
occur in the current scanner; it's least wrong if we write out an
<any> type.
|
|
|
|
|
|
|
|
| |
We now support an extensible mechanism where arbitrary key-value
pairs may be associated with almost all items, including objects,
methods, and properties.
These attributes appear in both the .gir and the .typelib.
|
| |
|
|
|
|
|
|
| |
We don't want people manually editing .gir files.
svn path=/trunk/; revision=1034
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
2009-01-12 Johan Dahlin <jdahlin@async.com.br>
Bug 563794 - Redo annotation parsing & applying
Thanks to Colin for helping out considerably in landing this.
* giscanner/Makefile.am:
* giscanner/ast.py:
* giscanner/dumper.py:
* giscanner/girparser.py:
* giscanner/giscannermodule.c (pygi_source_scanner_get_comments),
(calc_attrs_length), (pygi_collect_attributes), (init_giscanner):
* giscanner/glibtransformer.py:
* giscanner/scannerlexer.l:
* giscanner/sourcescanner.c (gi_source_symbol_unref),
(gi_source_scanner_new), (gi_source_scanner_free),
(gi_source_scanner_get_comments):
* giscanner/sourcescanner.h:
* giscanner/sourcescanner.py:
* giscanner/transformer.py:
* giscanner/xmlwriter.py:
* tests/scanner/annotation-1.0-expected.gir:
* tests/scanner/annotation-1.0-expected.tgir:
* tests/scanner/annotation.c:
* tests/scanner/annotation.h:
* tests/scanner/foo-1.0-expected.gir:
* tests/scanner/foo-1.0-expected.tgir:
* tests/scanner/foo.h:
* tools/g-ir-scanner:
This commit merges the annotation parser rewrite branch.
It'll change the annotation parsing to be done completely in python
code which will make it easier to do further annotation parsing
easier.
svn path=/trunk/; revision=1017
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
2009-01-03 Jürg Billeter <j@bitron.ch>
* giscanner/ast.py:
* giscanner/dumper.py:
* giscanner/girparser.py:
* giscanner/glibtransformer.py:
* giscanner/sourcescanner.py:
* giscanner/transformer.py:
* giscanner/xmlwriter.py:
Fix inconsistencies with PEP8
svn path=/trunk/; revision=997
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
2008-10-30 Johan Dahlin <jdahlin@async.com.br>
* giscanner/giscannermodule.c (calc_attrs_length),
(pygi_collect_attributes):
* giscanner/xmlwriter.py:
Write a C version of the xml namespace formatter.
Saves 15% of the time it takes to create a gtk gir.
svn path=/trunk/; revision=846
|
|
|
|
|
|
|
|
|
|
| |
2008-10-30 Johan Dahlin <jdahlin@async.com.br>
* giscanner/xmlwriter.py: Abstract attribute formatting
to a function external to the XMLWriter class.
svn path=/trunk/; revision=845
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
2008-10-11 Lucas Rocha <lucasr@gnome.org>
Bug 554854: The --typelib-xml and --inject options should reuse
giscanner parser/writer.
* giscanner/ast.py: add constructor list to Struct and Union.
Add new param in Return's contructor to define transfer.
* giscanner/girparser.py: several additions to the parser in order
to have parsing all nodes of the gir xml files.
* tools/g-ir-scanner (typelib_xml_strip, inject): use gir parser
and writer in --inject and --typelib-xml options.
* giscanner/xmlwriter.py: ignore empty attributes instead of
raising an error as this basically exposes a bug in GIRParser.
This should be reverted as soon as the parser is fixed.
svn path=/trunk/; revision=665
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
2008-08-22 Colin Walters <walters@verbum.org>
* girepository/girparser.c: Pass through
recursive types. Avoid overwriting errors.
* giscanner/xmlwriter.py: Always write the
XML header.
* tests/*.gir: Adjust.
* tests/scanner/Makefile.am: Build typelibs,
and generate XML from those. Once we
have a good diff mechanism...
* tests/scanner/*-expected.gir: Add XML
header.
* tools/g-ir-scanner: Accept --typelib-xml
option.
* tools/generate.c: Better defaults for transfer.
svn path=/trunk/; revision=457
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
| |
2008-06-07 Johan Dahlin <jdahlin@async.com.br>
* giscanner/xmlwriter.py:
Improve line wrapping when > 79 charaters
svn path=/trunk/; revision=286
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
2008-05-31 Johan Dahlin <jdahlin@async.com.br>
* giscanner/xmlwriter.py:
Improve error reporting when trying to quote None.
* giscanner/girparser.py:
Do not print warnings when including more complete .gir files
* giscanner/girwriter.py:
Do not require a name for parameters, add a todo for singletons
* giscanner/glibtransformer.py:
Refactor the way structs are done, add a couple of hacks to allow
us to get further.
* giscanner/transformer.py:
Add enough hacks so cairo, atk and pango.gir can be parsed properly
* gobject-introspection-1.0.pc.in:
Export girdir, so we can access gobject-2.0.gir from outside
svn path=/trunk/; revision=280
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
2008-04-29 Johan Dahlin <jdahlin@async.com.br>
* giscanner/girwriter.py:
* giscanner/glibtransformer.py:
* giscanner/transformer.py:
* giscanner/xmlwriter.py:
* tests/parser/Foo-expected.gir:
* tests/parser/foo-object.h:
Write record/structs to gir file too. Add a couple of tests,
fix an off by one error in xmlwriter.py.
svn path=/trunk/; revision=257
|
|
|
|
|
|
|
|
|
|
| |
2008-04-28 Johan Dahlin <johan@gnome.org>
* giscanner/xmlwriter.py: Calculate the line length properly,
include the provided extra indentation in the calculation, really.
svn path=/trunk/; revision=256
|
|
|
|
| |
svn path=/trunk/; revision=248
|
|
|
|
| |
svn path=/trunk/; revision=247
|
|
|
|
|
|
|
|
|
|
|
| |
2008-04-27 Johan Dahlin <johan@gnome.org>
* giscanner/xmlwriter.py:
* tests/parser/Foo-expected.gir:
Include indentation in line length calculation
svn path=/trunk/; revision=239
|
|
|
|
| |
svn path=/trunk/; revision=236
|
|
|
|
|
|
|
|
|
|
| |
2008-04-27 Johan Dahlin <johan@gnome.org>
* giscanner/xmlwriter.py:
Wrap attributes for lines which are wider than 79 characters
svn path=/trunk/; revision=235
|
|
|
|
| |
svn path=/trunk/; revision=234
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
2008-04-25 Johan Dahlin <jdahlin@async.com.br>
* giscanner/Makefile.am:
* giscanner/__init__.py:
* giscanner/cgobject.py:
* giscanner/gidlparser.py:
* giscanner/gidlwriter.py:
* giscanner/girwriter.py:
* giscanner/gobjecttreebuilder.py:
* giscanner/odict.py:
* giscanner/sourcescanner.py:
* giscanner/treebuilder.py:
* giscanner/xmlwriter.py:
* tools/Makefile.am:
* tools/g-ir-scanner:
Add LGPLv2 license header and install all python files
svn path=/trunk/; revision=227
|
|
|
|
|
|
|
|
|
|
|
|
| |
2008-04-21 Johan Dahlin <jdahlin@async.com.br>
* giscanner/gidlwriter.py:
* giscanner/xmlwriter.py:
Add a simple api for writing tags which can be used
with the new 'with statement' in python 2.5
svn path=/trunk/; revision=190
|
|
2008-04-18 Johan Dahlin <jdahlin@async.com.br>
* giscanner/gidlwriter.py:
* giscanner/xmlwriter.py:
* tools/g-ir-scanner:
Add a simplistic gidl writer, which can't do too much.
svn path=/trunk/; revision=175
|