gobject-introspection 2.0.2-x86-mingw32 → 2.0.3-x86-mingw32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/Rakefile +5 -2
- data/ext/gobject-introspection/rb-gi-argument.c +215 -4
- data/ext/gobject-introspection/rb-gi-loader.c +7 -2
- data/ext/gobject-introspection/rb-gi-struct-info.c +1 -1
- data/lib/1.9/gobject_introspection.so +0 -0
- data/lib/2.0/gobject_introspection.so +0 -0
- data/test/test-function-info.rb +3 -1
- data/vendor/local/bin/g-ir-compiler.exe +0 -0
- data/vendor/local/bin/g-ir-generate.exe +0 -0
- data/vendor/local/bin/libgirepository-1.0-1.dll +0 -0
- data/vendor/local/lib/girepository-1.0/DBus-1.0.typelib +0 -0
- data/vendor/local/lib/girepository-1.0/DBusGLib-1.0.typelib +0 -0
- data/vendor/local/lib/girepository-1.0/GIRepository-2.0.typelib +0 -0
- data/vendor/local/lib/girepository-1.0/GLib-2.0.typelib +0 -0
- data/vendor/local/lib/girepository-1.0/GModule-2.0.typelib +0 -0
- data/vendor/local/lib/girepository-1.0/GObject-2.0.typelib +0 -0
- data/vendor/local/lib/girepository-1.0/Gio-2.0.typelib +0 -0
- data/vendor/local/lib/girepository-1.0/win32-1.0.typelib +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/__init__.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/__init__.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/annotationmain.py +1 -0
- data/vendor/local/lib/gobject-introspection/giscanner/annotationmain.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/annotationmain.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/annotationparser.py +52 -47
- data/vendor/local/lib/gobject-introspection/giscanner/annotationparser.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/annotationparser.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/ast.py +48 -42
- data/vendor/local/lib/gobject-introspection/giscanner/ast.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/ast.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/cachestore.py +11 -10
- data/vendor/local/lib/gobject-introspection/giscanner/cachestore.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/cachestore.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/codegen.py +7 -5
- data/vendor/local/lib/gobject-introspection/giscanner/codegen.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/codegen.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/collections/__init__.py +22 -0
- data/vendor/local/lib/gobject-introspection/giscanner/collections/__init__.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/collections/__init__.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/collections/ordereddict.py +120 -0
- data/vendor/local/lib/gobject-introspection/giscanner/collections/ordereddict.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/collections/ordereddict.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/docmain.py +14 -2
- data/vendor/local/lib/gobject-introspection/giscanner/docmain.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/docmain.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/docwriter.py +19 -10
- data/vendor/local/lib/gobject-introspection/giscanner/docwriter.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/docwriter.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/dumper.py +18 -11
- data/vendor/local/lib/gobject-introspection/giscanner/dumper.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/dumper.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.py +10 -13
- data/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/girparser.py +24 -30
- data/vendor/local/lib/gobject-introspection/giscanner/girparser.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/girparser.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/girwriter.py +11 -12
- data/vendor/local/lib/gobject-introspection/giscanner/girwriter.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/girwriter.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/introspectablepass.py +25 -21
- data/vendor/local/lib/gobject-introspection/giscanner/introspectablepass.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/introspectablepass.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/libtoolimporter.py +1 -1
- data/vendor/local/lib/gobject-introspection/giscanner/libtoolimporter.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/libtoolimporter.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/maintransformer.py +98 -100
- data/vendor/local/lib/gobject-introspection/giscanner/maintransformer.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/maintransformer.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/message.py +10 -8
- data/vendor/local/lib/gobject-introspection/giscanner/message.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/message.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/scannermain.py +28 -16
- data/vendor/local/lib/gobject-introspection/giscanner/scannermain.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/scannermain.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/sectionparser.py +83 -9
- data/vendor/local/lib/gobject-introspection/giscanner/sectionparser.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/sectionparser.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/shlibs.py +5 -1
- data/vendor/local/lib/gobject-introspection/giscanner/shlibs.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/shlibs.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/sourcescanner.py +20 -21
- data/vendor/local/lib/gobject-introspection/giscanner/sourcescanner.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/sourcescanner.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/testcodegen.py +3 -0
- data/vendor/local/lib/gobject-introspection/giscanner/testcodegen.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/testcodegen.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/transformer.py +32 -41
- data/vendor/local/lib/gobject-introspection/giscanner/transformer.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/transformer.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/utils.py +9 -0
- data/vendor/local/lib/gobject-introspection/giscanner/utils.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/utils.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/xmlwriter.py +9 -11
- data/vendor/local/lib/gobject-introspection/giscanner/xmlwriter.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/xmlwriter.pyo +0 -0
- data/vendor/local/lib/libgirepository-1.0.a +0 -0
- data/vendor/local/lib/libgirepository-1.0.dll.a +0 -0
- data/vendor/local/lib/libgirepository-1.0.la +1 -1
- data/vendor/local/lib/pkgconfig/gobject-introspection-1.0.pc +1 -1
- data/vendor/local/lib/pkgconfig/gobject-introspection-no-export-1.0.pc +1 -1
- data/vendor/local/share/gir-1.0/GIRepository-2.0.gir +691 -691
- data/vendor/local/share/gir-1.0/GLib-2.0.gir +6972 -6467
- data/vendor/local/share/gir-1.0/GModule-2.0.gir +103 -4
- data/vendor/local/share/gir-1.0/GObject-2.0.gir +2085 -1955
- data/vendor/local/share/gir-1.0/Gio-2.0.gir +10955 -9269
- data/vendor/local/share/gir-1.0/win32-1.0.gir +19 -0
- data/vendor/local/share/gobject-introspection-1.0/Makefile.introspection +2 -2
- data/vendor/local/share/gobject-introspection-1.0/gdump.c +7 -2
- data/vendor/local/share/gobject-introspection-1.0/tests/annotation.c +15 -15
- data/vendor/local/share/gobject-introspection-1.0/tests/annotation.h +1 -1
- data/vendor/local/share/gobject-introspection-1.0/tests/gimarshallingtests.c +14 -0
- data/vendor/local/share/gobject-introspection-1.0/tests/gimarshallingtests.h +2 -2
- data/vendor/local/share/gobject-introspection-1.0/tests/regress.c +8 -0
- data/vendor/local/share/gobject-introspection-1.0/tests/regress.h +9 -0
- metadata +20 -21
- data/vendor/local/lib/gobject-introspection/giscanner/odict.py +0 -50
- data/vendor/local/lib/gobject-introspection/giscanner/odict.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/odict.pyo +0 -0
@@ -31,6 +31,7 @@ import giscanner
|
|
31
31
|
|
32
32
|
_CACHE_VERSION_FILENAME = '.cache-version'
|
33
33
|
|
34
|
+
|
34
35
|
def _get_versionhash():
|
35
36
|
toplevel = os.path.dirname(giscanner.__file__)
|
36
37
|
# Use pyc instead of py to avoid extra IO
|
@@ -40,6 +41,7 @@ def _get_versionhash():
|
|
40
41
|
mtimes = (str(os.stat(source).st_mtime) for source in sources)
|
41
42
|
return hashlib.sha1(''.join(mtimes)).hexdigest()
|
42
43
|
|
44
|
+
|
43
45
|
def _get_cachedir():
|
44
46
|
if 'GI_SCANNER_DISABLE_CACHE' in os.environ:
|
45
47
|
return None
|
@@ -73,7 +75,7 @@ class CacheStore(object):
|
|
73
75
|
def __init__(self):
|
74
76
|
try:
|
75
77
|
self._directory = _get_cachedir()
|
76
|
-
except OSError
|
78
|
+
except OSError as e:
|
77
79
|
if e.errno != errno.EPERM:
|
78
80
|
raise
|
79
81
|
self._directory = None
|
@@ -88,7 +90,7 @@ class CacheStore(object):
|
|
88
90
|
version = os.path.join(self._directory, _CACHE_VERSION_FILENAME)
|
89
91
|
try:
|
90
92
|
cache_hash = open(version).read()
|
91
|
-
except IOError
|
93
|
+
except IOError as e:
|
92
94
|
# File does not exist
|
93
95
|
if e.errno == errno.ENOENT:
|
94
96
|
cache_hash = 0
|
@@ -101,7 +103,7 @@ class CacheStore(object):
|
|
101
103
|
self._clean()
|
102
104
|
try:
|
103
105
|
fp = open(version, 'w')
|
104
|
-
except IOError
|
106
|
+
except IOError as e:
|
105
107
|
# Permission denied
|
106
108
|
if e.errno == errno.EACCES:
|
107
109
|
return
|
@@ -126,13 +128,13 @@ class CacheStore(object):
|
|
126
128
|
def _remove_filename(self, filename):
|
127
129
|
try:
|
128
130
|
os.unlink(filename)
|
129
|
-
except IOError
|
131
|
+
except IOError as e:
|
130
132
|
# Permission denied
|
131
133
|
if e.errno == errno.EACCES:
|
132
134
|
return
|
133
135
|
else:
|
134
136
|
raise
|
135
|
-
except OSError
|
137
|
+
except OSError as e:
|
136
138
|
# File does not exist
|
137
139
|
if e.errno == errno.ENOENT:
|
138
140
|
return
|
@@ -150,14 +152,13 @@ class CacheStore(object):
|
|
150
152
|
if store_filename is None:
|
151
153
|
return
|
152
154
|
|
153
|
-
if (os.path.exists(store_filename) and
|
154
|
-
self._cache_is_valid(store_filename, filename)):
|
155
|
+
if (os.path.exists(store_filename) and self._cache_is_valid(store_filename, filename)):
|
155
156
|
return None
|
156
157
|
|
157
158
|
tmp_fd, tmp_filename = tempfile.mkstemp(prefix='g-ir-scanner-cache-')
|
158
159
|
try:
|
159
160
|
cPickle.dump(data, os.fdopen(tmp_fd, 'w'))
|
160
|
-
except IOError
|
161
|
+
except IOError as e:
|
161
162
|
# No space left on device
|
162
163
|
if e.errno == errno.ENOSPC:
|
163
164
|
self._remove_filename(tmp_filename)
|
@@ -167,7 +168,7 @@ class CacheStore(object):
|
|
167
168
|
|
168
169
|
try:
|
169
170
|
shutil.move(tmp_filename, store_filename)
|
170
|
-
except IOError
|
171
|
+
except IOError as e:
|
171
172
|
# Permission denied
|
172
173
|
if e.errno == errno.EACCES:
|
173
174
|
self._remove_filename(tmp_filename)
|
@@ -180,7 +181,7 @@ class CacheStore(object):
|
|
180
181
|
return
|
181
182
|
try:
|
182
183
|
fd = open(store_filename)
|
183
|
-
except IOError
|
184
|
+
except IOError as e:
|
184
185
|
if e.errno == errno.ENOENT:
|
185
186
|
return None
|
186
187
|
else:
|
Binary file
|
Binary file
|
@@ -24,6 +24,7 @@ from contextlib import contextmanager
|
|
24
24
|
|
25
25
|
from . import ast
|
26
26
|
|
27
|
+
|
27
28
|
class CCodeGenerator(object):
|
28
29
|
def __init__(self, namespace, out_h_filename, out_c_filename):
|
29
30
|
self.out_h_filename = out_h_filename
|
@@ -36,15 +37,16 @@ class CCodeGenerator(object):
|
|
36
37
|
return '%s_%s' % (self.namespace.symbol_prefixes[0], name)
|
37
38
|
|
38
39
|
def _typecontainer_to_ctype(self, param):
|
39
|
-
if (isinstance(param, ast.Parameter)
|
40
|
-
|
41
|
-
ast.PARAM_DIRECTION_INOUT)):
|
40
|
+
if (isinstance(param, ast.Parameter)
|
41
|
+
and param.direction in (ast.PARAM_DIRECTION_OUT, ast.PARAM_DIRECTION_INOUT)):
|
42
42
|
suffix = '*'
|
43
43
|
else:
|
44
44
|
suffix = ''
|
45
|
-
|
46
|
-
|
45
|
+
|
46
|
+
if (param.type.is_equiv((ast.TYPE_STRING, ast.TYPE_FILENAME))
|
47
|
+
and param.transfer == ast.PARAM_TRANSFER_NONE):
|
47
48
|
return "const gchar*" + suffix
|
49
|
+
|
48
50
|
return param.type.ctype + suffix
|
49
51
|
|
50
52
|
def _write_prelude(self, out, func):
|
Binary file
|
Binary file
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# -*- Mode: Python -*-
|
2
|
+
# GObject-Introspection - a framework for introspecting GObject libraries
|
3
|
+
# Copyright (C) 2013 Dieter Verfaillie <dieterv@optionexplicit.be>
|
4
|
+
#
|
5
|
+
# This program is free software; you can redistribute it and/or
|
6
|
+
# modify it under the terms of the GNU General Public License
|
7
|
+
# as published by the Free Software Foundation; either version 2
|
8
|
+
# of the License, or (at your option) any later version.
|
9
|
+
#
|
10
|
+
# This program is distributed in the hope that it will be useful,
|
11
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
|
+
# GNU General Public License for more details.
|
14
|
+
#
|
15
|
+
# You should have received a copy of the GNU General Public License
|
16
|
+
# along with this program; if not, write to the Free Software
|
17
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
18
|
+
# 02110-1301, USA.
|
19
|
+
#
|
20
|
+
|
21
|
+
|
22
|
+
from .ordereddict import OrderedDict
|
@@ -0,0 +1,120 @@
|
|
1
|
+
# -*- Mode: Python -*-
|
2
|
+
# GObject-Introspection - a framework for introspecting GObject libraries
|
3
|
+
# Copyright (C) 2008 Johan Dahlin
|
4
|
+
# Copyright (C) 2013 Dieter Verfaillie <dieterv@optionexplicit.be>
|
5
|
+
#
|
6
|
+
# This library is free software; you can redistribute it and/or
|
7
|
+
# modify it under the terms of the GNU Lesser General Public
|
8
|
+
# License as published by the Free Software Foundation; either
|
9
|
+
# version 2 of the License, or (at your option) any later version.
|
10
|
+
#
|
11
|
+
# This library is distributed in the hope that it will be useful,
|
12
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14
|
+
# Lesser General Public License for more details.
|
15
|
+
#
|
16
|
+
# You should have received a copy of the GNU Lesser General Public
|
17
|
+
# License along with this library; if not, write to the
|
18
|
+
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
19
|
+
# Boston, MA 02111-1307, USA.
|
20
|
+
|
21
|
+
|
22
|
+
# Borrowed from:
|
23
|
+
# http://hg.sqlalchemy.org/sqlalchemy/raw-file/77e2264283d4/lib/sqlalchemy/util/_collections.py
|
24
|
+
# http://hg.sqlalchemy.org/sqlalchemy/raw-file/77e2264283d4/AUTHORS
|
25
|
+
#
|
26
|
+
# util/_collections.py
|
27
|
+
# Copyright (C) 2005-2012 the SQLAlchemy authors and contributors <see AUTHORS file>
|
28
|
+
#
|
29
|
+
# This module is part of SQLAlchemy and is released under
|
30
|
+
# the MIT License: http://www.opensource.org/licenses/mit-license.php
|
31
|
+
|
32
|
+
|
33
|
+
class OrderedDict(dict):
|
34
|
+
"""A dict that returns keys/values/items in the order they were added."""
|
35
|
+
|
36
|
+
def __init__(self, ____sequence=None, **kwargs):
|
37
|
+
self._list = []
|
38
|
+
if ____sequence is None:
|
39
|
+
if kwargs:
|
40
|
+
self.update(**kwargs)
|
41
|
+
else:
|
42
|
+
self.update(____sequence, **kwargs)
|
43
|
+
|
44
|
+
def clear(self):
|
45
|
+
self._list = []
|
46
|
+
dict.clear(self)
|
47
|
+
|
48
|
+
def copy(self):
|
49
|
+
return self.__copy__()
|
50
|
+
|
51
|
+
def __copy__(self):
|
52
|
+
return OrderedDict(self)
|
53
|
+
|
54
|
+
def sort(self, *arg, **kw):
|
55
|
+
self._list.sort(*arg, **kw)
|
56
|
+
|
57
|
+
def update(self, ____sequence=None, **kwargs):
|
58
|
+
if ____sequence is not None:
|
59
|
+
if hasattr(____sequence, 'keys'):
|
60
|
+
for key in ____sequence.keys():
|
61
|
+
self.__setitem__(key, ____sequence[key])
|
62
|
+
else:
|
63
|
+
for key, value in ____sequence:
|
64
|
+
self[key] = value
|
65
|
+
if kwargs:
|
66
|
+
self.update(kwargs)
|
67
|
+
|
68
|
+
def setdefault(self, key, value):
|
69
|
+
if key not in self:
|
70
|
+
self.__setitem__(key, value)
|
71
|
+
return value
|
72
|
+
else:
|
73
|
+
return self.__getitem__(key)
|
74
|
+
|
75
|
+
def __iter__(self):
|
76
|
+
return iter(self._list)
|
77
|
+
|
78
|
+
def values(self):
|
79
|
+
return [self[key] for key in self._list]
|
80
|
+
|
81
|
+
def itervalues(self):
|
82
|
+
return iter([self[key] for key in self._list])
|
83
|
+
|
84
|
+
def keys(self):
|
85
|
+
return list(self._list)
|
86
|
+
|
87
|
+
def iterkeys(self):
|
88
|
+
return iter(self.keys())
|
89
|
+
|
90
|
+
def items(self):
|
91
|
+
return [(key, self[key]) for key in self.keys()]
|
92
|
+
|
93
|
+
def iteritems(self):
|
94
|
+
return iter(self.items())
|
95
|
+
|
96
|
+
def __setitem__(self, key, obj):
|
97
|
+
if key not in self:
|
98
|
+
try:
|
99
|
+
self._list.append(key)
|
100
|
+
except AttributeError:
|
101
|
+
# work around Python pickle loads() with
|
102
|
+
# dict subclass (seems to ignore __setstate__?)
|
103
|
+
self._list = [key]
|
104
|
+
dict.__setitem__(self, key, obj)
|
105
|
+
|
106
|
+
def __delitem__(self, key):
|
107
|
+
dict.__delitem__(self, key)
|
108
|
+
self._list.remove(key)
|
109
|
+
|
110
|
+
def pop(self, key, *default):
|
111
|
+
present = key in self
|
112
|
+
value = dict.pop(self, key, *default)
|
113
|
+
if present:
|
114
|
+
self._list.remove(key)
|
115
|
+
return value
|
116
|
+
|
117
|
+
def popitem(self):
|
118
|
+
item = dict.popitem(self)
|
119
|
+
self._list.remove(item[0])
|
120
|
+
return item
|
@@ -22,8 +22,10 @@ import os
|
|
22
22
|
import optparse
|
23
23
|
|
24
24
|
from .docwriter import DocWriter
|
25
|
+
from .sectionparser import generate_sections_file, write_sections_file
|
25
26
|
from .transformer import Transformer
|
26
27
|
|
28
|
+
|
27
29
|
def doc_main(args):
|
28
30
|
parser = optparse.OptionParser('%prog [options] GIR-file')
|
29
31
|
|
@@ -37,6 +39,9 @@ def doc_main(args):
|
|
37
39
|
parser.add_option("", "--add-include-path",
|
38
40
|
action="append", dest="include_paths", default=[],
|
39
41
|
help="include paths for other GIR files")
|
42
|
+
parser.add_option("", "--write-sections-file",
|
43
|
+
action="store_true", dest="write_sections",
|
44
|
+
help="Generate and write out a sections file")
|
40
45
|
|
41
46
|
options, args = parser.parse_args(args)
|
42
47
|
if not options.output:
|
@@ -54,7 +59,14 @@ def doc_main(args):
|
|
54
59
|
extra_include_dirs.extend(options.include_paths)
|
55
60
|
transformer = Transformer.parse_from_gir(args[1], extra_include_dirs)
|
56
61
|
|
57
|
-
|
58
|
-
|
62
|
+
if options.write_sections:
|
63
|
+
sections_file = generate_sections_file(transformer)
|
64
|
+
|
65
|
+
fp = open(options.output, 'w')
|
66
|
+
write_sections_file(fp, sections_file)
|
67
|
+
fp.close()
|
68
|
+
else:
|
69
|
+
writer = DocWriter(transformer, options.language)
|
70
|
+
writer.write(options.output)
|
59
71
|
|
60
72
|
return 0
|
Binary file
|
Binary file
|
@@ -31,6 +31,7 @@ from mako.lookup import TemplateLookup
|
|
31
31
|
from . import ast, xmlwriter
|
32
32
|
from .utils import to_underscores
|
33
33
|
|
34
|
+
|
34
35
|
def make_page_id(node, recursive=False):
|
35
36
|
if isinstance(node, ast.Namespace):
|
36
37
|
if recursive:
|
@@ -51,6 +52,7 @@ def make_page_id(node, recursive=False):
|
|
51
52
|
else:
|
52
53
|
return '%s.%s' % (make_page_id(parent, recursive=True), node.name)
|
53
54
|
|
55
|
+
|
54
56
|
def get_node_kind(node):
|
55
57
|
if isinstance(node, ast.Namespace):
|
56
58
|
node_kind = 'namespace'
|
@@ -78,6 +80,7 @@ def get_node_kind(node):
|
|
78
80
|
|
79
81
|
return node_kind
|
80
82
|
|
83
|
+
|
81
84
|
class TemplatedScanner(object):
|
82
85
|
def __init__(self, specs):
|
83
86
|
self.specs = self.unmangle_specs(specs)
|
@@ -141,6 +144,7 @@ class TemplatedScanner(object):
|
|
141
144
|
if pos < len(text):
|
142
145
|
yield ('other', text[pos:], None)
|
143
146
|
|
147
|
+
|
144
148
|
class DocstringScanner(TemplatedScanner):
|
145
149
|
def __init__(self):
|
146
150
|
specs = [
|
@@ -156,6 +160,7 @@ class DocstringScanner(TemplatedScanner):
|
|
156
160
|
|
157
161
|
super(DocstringScanner, self).__init__(specs)
|
158
162
|
|
163
|
+
|
159
164
|
class DocFormatter(object):
|
160
165
|
def __init__(self, transformer):
|
161
166
|
self._transformer = transformer
|
@@ -219,7 +224,7 @@ class DocFormatter(object):
|
|
219
224
|
|
220
225
|
try:
|
221
226
|
prop = self._find_thing(type_node.properties, props['property_name'])
|
222
|
-
except (AttributeError, KeyError)
|
227
|
+
except (AttributeError, KeyError):
|
223
228
|
return match
|
224
229
|
|
225
230
|
return self.format_xref(prop)
|
@@ -231,7 +236,7 @@ class DocFormatter(object):
|
|
231
236
|
|
232
237
|
try:
|
233
238
|
signal = self._find_thing(type_node.signals, props['signal_name'])
|
234
|
-
except (AttributeError, KeyError)
|
239
|
+
except (AttributeError, KeyError):
|
235
240
|
return match
|
236
241
|
|
237
242
|
return self.format_xref(signal)
|
@@ -260,7 +265,7 @@ class DocFormatter(object):
|
|
260
265
|
def _process_parameter(self, node, match, props):
|
261
266
|
try:
|
262
267
|
parameter = node.get_parameter(props['param_name'])
|
263
|
-
except (AttributeError, ValueError)
|
268
|
+
except (AttributeError, ValueError):
|
264
269
|
return match
|
265
270
|
|
266
271
|
return '<code>%s</code>' % (self.format_parameter_name(node, parameter), )
|
@@ -358,6 +363,7 @@ class DocFormatter(object):
|
|
358
363
|
parent_chain.reverse()
|
359
364
|
return parent_chain
|
360
365
|
|
366
|
+
|
361
367
|
class DocFormatterC(DocFormatter):
|
362
368
|
language = "C"
|
363
369
|
mime_type = "text/x-csrc"
|
@@ -380,7 +386,7 @@ class DocFormatterC(DocFormatter):
|
|
380
386
|
return getattr(node, 'ctype')
|
381
387
|
|
382
388
|
def format_function_name(self, func):
|
383
|
-
if isinstance(func,
|
389
|
+
if isinstance(func, ast.Function):
|
384
390
|
return func.symbol
|
385
391
|
else:
|
386
392
|
return func.name
|
@@ -388,6 +394,7 @@ class DocFormatterC(DocFormatter):
|
|
388
394
|
def get_parameters(self, node):
|
389
395
|
return node.all_parameters
|
390
396
|
|
397
|
+
|
391
398
|
class DocFormatterIntrospectableBase(DocFormatter):
|
392
399
|
def should_render_node(self, node):
|
393
400
|
if isinstance(node, ast.Record) and node.is_gtype_struct_for is not None:
|
@@ -398,6 +405,7 @@ class DocFormatterIntrospectableBase(DocFormatter):
|
|
398
405
|
|
399
406
|
return super(DocFormatterIntrospectableBase, self).should_render_node(node)
|
400
407
|
|
408
|
+
|
401
409
|
class DocFormatterPython(DocFormatterIntrospectableBase):
|
402
410
|
language = "Python"
|
403
411
|
mime_type = "text/python"
|
@@ -418,7 +426,7 @@ class DocFormatterPython(DocFormatterIntrospectableBase):
|
|
418
426
|
if getattr(node, "is_method", False):
|
419
427
|
return True
|
420
428
|
|
421
|
-
if isinstance(node,
|
429
|
+
if isinstance(node, ast.VFunction):
|
422
430
|
return True
|
423
431
|
|
424
432
|
return False
|
@@ -451,8 +459,7 @@ class DocFormatterPython(DocFormatterIntrospectableBase):
|
|
451
459
|
"GParam": "GLib.Param",
|
452
460
|
"PyObject": "object",
|
453
461
|
"GStrv": "[str]",
|
454
|
-
"GVariant": "GLib.Variant"
|
455
|
-
}
|
462
|
+
"GVariant": "GLib.Variant"}
|
456
463
|
|
457
464
|
return fundamental_types.get(name, name)
|
458
465
|
|
@@ -476,6 +483,7 @@ class DocFormatterPython(DocFormatterIntrospectableBase):
|
|
476
483
|
def get_parameters(self, node):
|
477
484
|
return node.all_parameters
|
478
485
|
|
486
|
+
|
479
487
|
class DocFormatterGjs(DocFormatterIntrospectableBase):
|
480
488
|
language = "Gjs"
|
481
489
|
mime_type = "text/x-gjs"
|
@@ -490,7 +498,7 @@ class DocFormatterGjs(DocFormatterIntrospectableBase):
|
|
490
498
|
if getattr(node, "is_method", False):
|
491
499
|
return True
|
492
500
|
|
493
|
-
if isinstance(node,
|
501
|
+
if isinstance(node, ast.VFunction):
|
494
502
|
return True
|
495
503
|
|
496
504
|
return False
|
@@ -514,8 +522,7 @@ class DocFormatterGjs(DocFormatterIntrospectableBase):
|
|
514
522
|
"GParam": "GLib.Param",
|
515
523
|
"PyObject": "Object",
|
516
524
|
"GStrv": "[String]",
|
517
|
-
"GVariant": "GLib.Variant"
|
518
|
-
}
|
525
|
+
"GVariant": "GLib.Variant"}
|
519
526
|
|
520
527
|
return fundamental_types.get(name, name)
|
521
528
|
|
@@ -558,12 +565,14 @@ class DocFormatterGjs(DocFormatterIntrospectableBase):
|
|
558
565
|
params.append(param)
|
559
566
|
return params
|
560
567
|
|
568
|
+
|
561
569
|
LANGUAGES = {
|
562
570
|
"c": DocFormatterC,
|
563
571
|
"python": DocFormatterPython,
|
564
572
|
"gjs": DocFormatterGjs,
|
565
573
|
}
|
566
574
|
|
575
|
+
|
567
576
|
class DocWriter(object):
|
568
577
|
def __init__(self, transformer, language):
|
569
578
|
self._transformer = transformer
|
Binary file
|
Binary file
|
@@ -89,7 +89,8 @@ class DumpCompiler(object):
|
|
89
89
|
# Enable the --msvc-syntax pkg-config flag when
|
90
90
|
# the Microsoft compiler is used
|
91
91
|
# (This is the other way to check whether Visual C++ is used subsequently)
|
92
|
-
|
92
|
+
args = self._compiler_cmd.split()
|
93
|
+
if 'cl.exe' in args or 'cl' in args:
|
93
94
|
self._pkgconfig_msvc_flags = '--msvc-syntax'
|
94
95
|
self._uninst_srcdir = os.environ.get(
|
95
96
|
'UNINSTALLED_INTROSPECTION_SRCDIR')
|
@@ -166,14 +167,14 @@ class DumpCompiler(object):
|
|
166
167
|
|
167
168
|
try:
|
168
169
|
self._compile(o_path, c_path)
|
169
|
-
except CompilerError
|
170
|
+
except CompilerError as e:
|
170
171
|
if not utils.have_debug_flag('save-temps'):
|
171
172
|
shutil.rmtree(tmpdir)
|
172
173
|
raise SystemExit('compilation of temporary binary failed:' + str(e))
|
173
174
|
|
174
175
|
try:
|
175
176
|
self._link(bin_path, o_path)
|
176
|
-
except LinkerError
|
177
|
+
except LinkerError as e:
|
177
178
|
if not utils.have_debug_flag('save-temps'):
|
178
179
|
shutil.rmtree(tmpdir)
|
179
180
|
raise SystemExit('linking of temporary binary failed: ' + str(e))
|
@@ -222,7 +223,7 @@ class DumpCompiler(object):
|
|
222
223
|
# The Microsoft compiler uses different option flags for
|
223
224
|
# compilation result output
|
224
225
|
if self._pkgconfig_msvc_flags:
|
225
|
-
args.extend(['-c', '-Fe'+output, '-Fo'+output])
|
226
|
+
args.extend(['-c', '-Fe' + output, '-Fo' + output])
|
226
227
|
else:
|
227
228
|
args.extend(['-c', '-o', output])
|
228
229
|
for source in sources:
|
@@ -236,7 +237,7 @@ class DumpCompiler(object):
|
|
236
237
|
sys.stdout.flush()
|
237
238
|
try:
|
238
239
|
subprocess.check_call(args)
|
239
|
-
except subprocess.CalledProcessError
|
240
|
+
except subprocess.CalledProcessError as e:
|
240
241
|
raise CompilerError(e)
|
241
242
|
|
242
243
|
def _link(self, output, *sources):
|
@@ -253,7 +254,7 @@ class DumpCompiler(object):
|
|
253
254
|
# We can use -o for the Microsoft compiler/linker,
|
254
255
|
# but it is considered deprecated usage with that
|
255
256
|
if self._pkgconfig_msvc_flags:
|
256
|
-
args.extend(['-Fe'+output])
|
257
|
+
args.extend(['-Fe' + output])
|
257
258
|
else:
|
258
259
|
args.extend(['-o', output])
|
259
260
|
if libtool:
|
@@ -290,7 +291,7 @@ class DumpCompiler(object):
|
|
290
291
|
sys.stdout.flush()
|
291
292
|
try:
|
292
293
|
subprocess.check_call(args)
|
293
|
-
except subprocess.CalledProcessError
|
294
|
+
except subprocess.CalledProcessError as e:
|
294
295
|
raise LinkerError(e)
|
295
296
|
|
296
297
|
def _add_link_internal_args(self, args, libtool):
|
@@ -312,18 +313,23 @@ class DumpCompiler(object):
|
|
312
313
|
if self._options.namespace_version:
|
313
314
|
args.append(str.lower(self._options.namespace_name) +
|
314
315
|
'-' +
|
315
|
-
self._options.namespace_version+'.lib')
|
316
|
+
self._options.namespace_version + '.lib')
|
316
317
|
else:
|
317
|
-
args.append(str.lower(self._options.namespace_name)+'.lib')
|
318
|
+
args.append(str.lower(self._options.namespace_name) + '.lib')
|
318
319
|
else:
|
319
320
|
args.append('-Wl,-rpath=.')
|
320
321
|
|
322
|
+
# Ensure libraries are always linked as we are going to use ldd to work
|
323
|
+
# out their names later
|
324
|
+
if not libtool and self._pkgconfig_msvc_flags == '':
|
325
|
+
args.append('-Wl,--no-as-needed')
|
326
|
+
|
321
327
|
for library in self._options.libraries:
|
322
328
|
# Visual C++: We have the needed .lib files now, and we need to link
|
323
329
|
# to .lib files, not the .dll as the --library option specifies the
|
324
330
|
# .dll(s) the .gir file refers to
|
325
331
|
if self._pkgconfig_msvc_flags == '':
|
326
|
-
if library.endswith(".la"):
|
332
|
+
if library.endswith(".la"): # explicitly specified libtool library
|
327
333
|
args.append(library)
|
328
334
|
else:
|
329
335
|
args.append('-l' + library)
|
@@ -352,11 +358,12 @@ class DumpCompiler(object):
|
|
352
358
|
# The --library option on Windows pass in the .dll file(s) the
|
353
359
|
# .gir files refer to, so don't link to them on Visual C++
|
354
360
|
if self._pkgconfig_msvc_flags == '':
|
355
|
-
if library.endswith(".la"):
|
361
|
+
if library.endswith(".la"): # explicitly specified libtool library
|
356
362
|
args.append(library)
|
357
363
|
else:
|
358
364
|
args.append('-l' + library)
|
359
365
|
|
366
|
+
|
360
367
|
def compile_introspection_binary(options, get_type_functions,
|
361
368
|
error_quark_functions):
|
362
369
|
dc = DumpCompiler(options, get_type_functions, error_quark_functions)
|
Binary file
|
Binary file
|