gobject-introspection 3.0.7-x86-mingw32 → 3.0.8-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +2 -2
- data/ext/gobject-introspection/extconf.rb +1 -0
- data/ext/gobject-introspection/rb-gi-argument.c +123 -26
- data/ext/gobject-introspection/rb-gi-function-info.c +558 -19
- data/ext/gobject-introspection/rb-gi-repository.c +9 -0
- data/ext/gobject-introspection/rb-gobject-introspection.h +3 -0
- data/lib/2.2/gobject_introspection.so +0 -0
- data/lib/2.3/gobject_introspection.so +0 -0
- data/lib/gobject-introspection/loader.rb +1 -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/include/gobject-introspection-1.0/gistructinfo.h +4 -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/gobject-introspection/giscanner/__init__.py +1 -1
- 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 +39 -11
- 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 +187 -164
- 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 +191 -58
- 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 +42 -54
- 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/ccompiler.py +272 -82
- data/vendor/local/lib/gobject-introspection/giscanner/ccompiler.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/ccompiler.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/codegen.py +18 -11
- 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 +4 -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/counter.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/collections/counter.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/collections/ordereddict.py +25 -13
- 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 +21 -19
- 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 -16
- 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 +148 -158
- 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 +31 -21
- 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 +13 -5
- 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 +12 -13
- 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 +5 -1
- 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 +11 -9
- 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 +150 -45
- 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 +56 -19
- 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/msvccompiler.py +101 -0
- data/vendor/local/lib/gobject-introspection/giscanner/msvccompiler.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/msvccompiler.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/scannermain.py +41 -22
- 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 +6 -1
- 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 +8 -2
- 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 +42 -56
- 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 +19 -5
- 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 +73 -37
- 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 +92 -14
- 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 +30 -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 +57 -13
- data/vendor/local/share/gir-1.0/GLib-2.0.gir +2018 -894
- data/vendor/local/share/gir-1.0/GModule-2.0.gir +2 -1
- data/vendor/local/share/gir-1.0/GObject-2.0.gir +1107 -674
- data/vendor/local/share/gir-1.0/Gio-2.0.gir +5589 -1287
- data/vendor/local/share/gobject-introspection-1.0/Makefile.introspection +4 -2
- data/vendor/local/share/gobject-introspection-1.0/gdump.c +8 -0
- data/vendor/local/share/gobject-introspection-1.0/tests/everything.c +273 -323
- data/vendor/local/share/gobject-introspection-1.0/tests/everything.h +58 -38
- data/vendor/local/share/gobject-introspection-1.0/tests/gimarshallingtests.c +1 -1
- data/vendor/local/share/gobject-introspection-1.0/tests/regress.c +177 -23
- data/vendor/local/share/gobject-introspection-1.0/tests/regress.h +40 -0
- data/vendor/local/share/man/man1/g-ir-compiler.1 +7 -7
- metadata +9 -7
- data/lib/2.0/gobject_introspection.so +0 -0
- data/lib/2.1/gobject_introspection.so +0 -0
Binary file
|
Binary file
|
@@ -18,6 +18,10 @@
|
|
18
18
|
# 02110-1301, USA.
|
19
19
|
#
|
20
20
|
|
21
|
+
from __future__ import absolute_import
|
22
|
+
from __future__ import division
|
23
|
+
from __future__ import print_function
|
24
|
+
from __future__ import unicode_literals
|
21
25
|
|
22
26
|
from .counter import Counter
|
23
27
|
from .ordereddict import OrderedDict
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -30,9 +30,20 @@
|
|
30
30
|
# the MIT License: http://www.opensource.org/licenses/mit-license.php
|
31
31
|
|
32
32
|
|
33
|
+
import sys
|
34
|
+
|
35
|
+
|
36
|
+
py2k = sys.version_info < (3, 0)
|
37
|
+
|
38
|
+
|
33
39
|
class OrderedDict(dict):
|
34
40
|
"""A dict that returns keys/values/items in the order they were added."""
|
35
41
|
|
42
|
+
__slots__ = '_list',
|
43
|
+
|
44
|
+
def __reduce__(self):
|
45
|
+
return OrderedDict, (self.items(),)
|
46
|
+
|
36
47
|
def __init__(self, ____sequence=None, **kwargs):
|
37
48
|
self._list = []
|
38
49
|
if ____sequence is None:
|
@@ -75,25 +86,26 @@ class OrderedDict(dict):
|
|
75
86
|
def __iter__(self):
|
76
87
|
return iter(self._list)
|
77
88
|
|
89
|
+
def keys(self):
|
90
|
+
return list(self)
|
91
|
+
|
78
92
|
def values(self):
|
79
93
|
return [self[key] for key in self._list]
|
80
94
|
|
81
|
-
def
|
82
|
-
return
|
83
|
-
|
84
|
-
def keys(self):
|
85
|
-
return list(self._list)
|
95
|
+
def items(self):
|
96
|
+
return [(key, self[key]) for key in self._list]
|
86
97
|
|
87
|
-
|
88
|
-
|
98
|
+
if py2k:
|
99
|
+
def itervalues(self):
|
100
|
+
return iter(self.values())
|
89
101
|
|
90
|
-
|
91
|
-
|
102
|
+
def iterkeys(self):
|
103
|
+
return iter(self)
|
92
104
|
|
93
|
-
|
94
|
-
|
105
|
+
def iteritems(self):
|
106
|
+
return iter(self.items())
|
95
107
|
|
96
|
-
def __setitem__(self, key,
|
108
|
+
def __setitem__(self, key, object):
|
97
109
|
if key not in self:
|
98
110
|
try:
|
99
111
|
self._list.append(key)
|
@@ -101,7 +113,7 @@ class OrderedDict(dict):
|
|
101
113
|
# work around Python pickle loads() with
|
102
114
|
# dict subclass (seems to ignore __setstate__?)
|
103
115
|
self._list = [key]
|
104
|
-
dict.__setitem__(self, key,
|
116
|
+
dict.__setitem__(self, key, object)
|
105
117
|
|
106
118
|
def __delitem__(self, key):
|
107
119
|
dict.__delitem__(self, key)
|
Binary file
|
Binary file
|
@@ -18,8 +18,13 @@
|
|
18
18
|
# 02110-1301, USA.
|
19
19
|
#
|
20
20
|
|
21
|
+
from __future__ import absolute_import
|
22
|
+
from __future__ import division
|
23
|
+
from __future__ import print_function
|
24
|
+
from __future__ import unicode_literals
|
25
|
+
|
21
26
|
import os
|
22
|
-
import
|
27
|
+
import argparse
|
23
28
|
|
24
29
|
from .docwriter import DocWriter
|
25
30
|
from .sectionparser import generate_sections_file, write_sections_file
|
@@ -27,46 +32,43 @@ from .transformer import Transformer
|
|
27
32
|
|
28
33
|
|
29
34
|
def doc_main(args):
|
30
|
-
parser =
|
35
|
+
parser = argparse.ArgumentParser()
|
31
36
|
|
32
|
-
parser.
|
37
|
+
parser.add_argument("girfile")
|
38
|
+
parser.add_argument("-o", "--output",
|
33
39
|
action="store", dest="output",
|
34
40
|
help="Directory to write output to")
|
35
|
-
parser.
|
41
|
+
parser.add_argument("-l", "--language",
|
36
42
|
action="store", dest="language",
|
37
43
|
default="c",
|
38
44
|
help="Output language")
|
39
|
-
parser.
|
45
|
+
parser.add_argument("-I", "--add-include-path",
|
40
46
|
action="append", dest="include_paths", default=[],
|
41
47
|
help="include paths for other GIR files")
|
42
|
-
parser.
|
48
|
+
parser.add_argument("-s", "--write-sections-file",
|
43
49
|
action="store_true", dest="write_sections",
|
44
50
|
help="Generate and write out a sections file")
|
45
51
|
|
46
|
-
|
47
|
-
if not
|
52
|
+
args = parser.parse_args(args[1:])
|
53
|
+
if not args.output:
|
48
54
|
raise SystemExit("missing output parameter")
|
49
55
|
|
50
|
-
if len(args) < 2:
|
51
|
-
raise SystemExit("Need an input GIR filename")
|
52
|
-
|
53
56
|
if 'UNINSTALLED_INTROSPECTION_SRCDIR' in os.environ:
|
54
57
|
top_srcdir = os.environ['UNINSTALLED_INTROSPECTION_SRCDIR']
|
55
58
|
top_builddir = os.environ['UNINSTALLED_INTROSPECTION_BUILDDIR']
|
56
59
|
extra_include_dirs = [os.path.join(top_srcdir, 'gir'), top_builddir]
|
57
60
|
else:
|
58
61
|
extra_include_dirs = []
|
59
|
-
extra_include_dirs.extend(
|
60
|
-
transformer = Transformer.parse_from_gir(args
|
62
|
+
extra_include_dirs.extend(args.include_paths)
|
63
|
+
transformer = Transformer.parse_from_gir(args.girfile, extra_include_dirs)
|
61
64
|
|
62
|
-
if
|
65
|
+
if args.write_sections:
|
63
66
|
sections_file = generate_sections_file(transformer)
|
64
67
|
|
65
|
-
|
66
|
-
|
67
|
-
fp.close()
|
68
|
+
with open(args.output, 'w') as fp:
|
69
|
+
write_sections_file(fp, sections_file)
|
68
70
|
else:
|
69
|
-
writer = DocWriter(transformer,
|
70
|
-
writer.write(
|
71
|
+
writer = DocWriter(transformer, args.language)
|
72
|
+
writer.write(args.output)
|
71
73
|
|
72
74
|
return 0
|
Binary file
|
Binary file
|
@@ -21,6 +21,11 @@
|
|
21
21
|
# 02110-1301, USA.
|
22
22
|
#
|
23
23
|
|
24
|
+
from __future__ import absolute_import
|
25
|
+
from __future__ import division
|
26
|
+
from __future__ import print_function
|
27
|
+
from __future__ import unicode_literals
|
28
|
+
|
24
29
|
import os
|
25
30
|
import re
|
26
31
|
import tempfile
|
@@ -131,7 +136,7 @@ class TemplatedScanner(object):
|
|
131
136
|
groupdict = match.groupdict()
|
132
137
|
properties = {name: groupdict.pop(name)}
|
133
138
|
name = name + "_"
|
134
|
-
for group, value in groupdict.
|
139
|
+
for group, value in groupdict.items():
|
135
140
|
if group.startswith(name):
|
136
141
|
key = group[len(name):]
|
137
142
|
properties[key] = value
|
@@ -349,7 +354,7 @@ class DocFormatter(object):
|
|
349
354
|
|
350
355
|
def format_xref(self, node, **attrdict):
|
351
356
|
if node is None or not hasattr(node, 'namespace'):
|
352
|
-
attrs = [('xref', 'index')] + attrdict.items()
|
357
|
+
attrs = [('xref', 'index')] + list(sorted(attrdict.items()))
|
353
358
|
return xmlwriter.build_xml_tag('link', attrs)
|
354
359
|
elif isinstance(node, ast.Member):
|
355
360
|
# Enum/BitField members are linked to the main enum page.
|
@@ -360,14 +365,14 @@ class DocFormatter(object):
|
|
360
365
|
return self.format_external_xref(node, attrdict)
|
361
366
|
|
362
367
|
def format_internal_xref(self, node, attrdict):
|
363
|
-
attrs = [('xref', make_page_id(node))] + attrdict.items()
|
368
|
+
attrs = [('xref', make_page_id(node))] + list(sorted(attrdict.items()))
|
364
369
|
return xmlwriter.build_xml_tag('link', attrs)
|
365
370
|
|
366
371
|
def format_external_xref(self, node, attrdict):
|
367
372
|
ns = node.namespace
|
368
373
|
attrs = [('href', '../%s-%s/%s.html' % (ns.name, str(ns.version),
|
369
374
|
make_page_id(node)))]
|
370
|
-
attrs += attrdict.items()
|
375
|
+
attrs += list(sorted(attrdict.items()))
|
371
376
|
return xmlwriter.build_xml_tag('link', attrs, self.format_page_name(node))
|
372
377
|
|
373
378
|
def field_is_writable(self, field):
|
@@ -435,7 +440,7 @@ class DocFormatter(object):
|
|
435
440
|
node_name = node.namespace.name + '.' + node.name
|
436
441
|
impl = []
|
437
442
|
|
438
|
-
for c in node.namespace.
|
443
|
+
for c in node.namespace.values():
|
439
444
|
if not isinstance(c, ast.Class):
|
440
445
|
continue
|
441
446
|
for implemented in c.interfaces:
|
@@ -601,8 +606,8 @@ class DocFormatterGjs(DocFormatterIntrospectableBase):
|
|
601
606
|
default_constructor = None
|
602
607
|
|
603
608
|
introspectable_constructors = \
|
604
|
-
filter(lambda c: getattr(c, 'introspectable', True),
|
605
|
-
node.constructors)
|
609
|
+
list(filter(lambda c: getattr(c, 'introspectable', True),
|
610
|
+
node.constructors))
|
606
611
|
for c in introspectable_constructors:
|
607
612
|
if zero_args_constructor is None and \
|
608
613
|
len(c.parameters) == 0:
|
@@ -859,12 +864,11 @@ class DocFormatterGjs(DocFormatterIntrospectableBase):
|
|
859
864
|
if isinstance(node, ast.Compound):
|
860
865
|
fields = filter(self.field_is_writable, node.fields)
|
861
866
|
out = ''
|
862
|
-
|
863
|
-
out += "
|
864
|
-
|
865
|
-
|
866
|
-
|
867
|
-
out += "}"
|
867
|
+
for f in fields:
|
868
|
+
out += " <link xref='%s.%s-%s'>%s</link>: value\n" % \
|
869
|
+
(node.namespace.name, node.name, f.name, f.name)
|
870
|
+
if out:
|
871
|
+
out = "{\n" + out + "}"
|
868
872
|
return out
|
869
873
|
else:
|
870
874
|
return ''
|
@@ -953,6 +957,5 @@ class DocWriter(object):
|
|
953
957
|
|
954
958
|
output_file_name = os.path.join(os.path.abspath(output),
|
955
959
|
page_id + '.page')
|
956
|
-
|
957
|
-
|
958
|
-
fp.close()
|
960
|
+
with open(output_file_name, 'wb') as fp:
|
961
|
+
fp.write(result)
|
Binary file
|
Binary file
|
@@ -19,11 +19,17 @@
|
|
19
19
|
# Boston, MA 02111-1307, USA.
|
20
20
|
#
|
21
21
|
|
22
|
+
from __future__ import absolute_import
|
23
|
+
from __future__ import division
|
24
|
+
from __future__ import print_function
|
25
|
+
from __future__ import unicode_literals
|
26
|
+
|
22
27
|
import os
|
23
28
|
import sys
|
24
29
|
import subprocess
|
25
30
|
import shutil
|
26
31
|
import tempfile
|
32
|
+
from distutils.errors import LinkError
|
27
33
|
|
28
34
|
from .gdumpparser import IntrospectionBinary
|
29
35
|
from . import utils
|
@@ -78,25 +84,24 @@ class LinkerError(Exception):
|
|
78
84
|
|
79
85
|
class DumpCompiler(object):
|
80
86
|
|
87
|
+
_compiler = None
|
88
|
+
|
81
89
|
def __init__(self, options, get_type_functions, error_quark_functions):
|
82
90
|
self._options = options
|
83
91
|
self._get_type_functions = get_type_functions
|
84
92
|
self._error_quark_functions = error_quark_functions
|
85
93
|
|
86
|
-
|
87
|
-
self.
|
94
|
+
# Acquire the compiler (and linker) commands via the CCompiler class in ccompiler.py
|
95
|
+
self._compiler = CCompiler()
|
96
|
+
|
88
97
|
self._pkgconfig_cmd = os.environ.get('PKG_CONFIG', 'pkg-config')
|
89
|
-
self.
|
90
|
-
# Enable the --msvc-syntax pkg-config flag when
|
91
|
-
# the Microsoft compiler is used
|
92
|
-
# (This is the other way to check whether Visual C++ is used subsequently)
|
93
|
-
args = self._compiler_cmd.split()
|
94
|
-
if 'cl.exe' in args or 'cl' in args:
|
95
|
-
self._pkgconfig_msvc_flags = '--msvc-syntax'
|
96
|
-
self._uninst_srcdir = os.environ.get(
|
97
|
-
'UNINSTALLED_INTROSPECTION_SRCDIR')
|
98
|
+
self._uninst_srcdir = os.environ.get('UNINSTALLED_INTROSPECTION_SRCDIR')
|
98
99
|
self._packages = ['gio-2.0 gmodule-2.0']
|
99
100
|
self._packages.extend(options.packages)
|
101
|
+
if hasattr(self._compiler.compiler, 'linker_exe'):
|
102
|
+
self._linker_cmd = self._compiler.compiler.linker_exe
|
103
|
+
else:
|
104
|
+
self._linker_cmd = []
|
100
105
|
|
101
106
|
# Public API
|
102
107
|
|
@@ -114,68 +119,59 @@ class DumpCompiler(object):
|
|
114
119
|
'gdump.c')
|
115
120
|
if not os.path.isfile(gdump_path):
|
116
121
|
raise SystemExit("Couldn't find %r" % (gdump_path, ))
|
117
|
-
|
118
|
-
|
119
|
-
gdump_file.close()
|
122
|
+
with open(gdump_path) as gdump_file:
|
123
|
+
gdump_contents = gdump_file.read()
|
120
124
|
tpl_args['gdump_include'] = gdump_contents
|
121
125
|
tpl_args['init_sections'] = "\n".join(self._options.init_sections)
|
122
126
|
|
123
127
|
c_path = self._generate_tempfile(tmpdir, '.c')
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
# during compilation, unlike .o files like GCC and others
|
158
|
-
if self._pkgconfig_msvc_flags:
|
159
|
-
o_path = self._generate_tempfile(tmpdir, '.obj')
|
160
|
-
else:
|
161
|
-
o_path = self._generate_tempfile(tmpdir, '.o')
|
162
|
-
|
163
|
-
if os.name == 'nt':
|
164
|
-
ext = '.exe'
|
128
|
+
with open(c_path, 'w') as f:
|
129
|
+
f.write(_PROGRAM_TEMPLATE % tpl_args)
|
130
|
+
|
131
|
+
# We need to reference our get_type and error_quark functions
|
132
|
+
# to make sure they are pulled in at the linking stage if the
|
133
|
+
# library is a static library rather than a shared library.
|
134
|
+
if len(self._get_type_functions) > 0:
|
135
|
+
for func in self._get_type_functions:
|
136
|
+
f.write("extern GType " + func + "(void);\n")
|
137
|
+
f.write("GType (*GI_GET_TYPE_FUNCS_[])(void) = {\n")
|
138
|
+
first = True
|
139
|
+
for func in self._get_type_functions:
|
140
|
+
if first:
|
141
|
+
first = False
|
142
|
+
else:
|
143
|
+
f.write(",\n")
|
144
|
+
f.write(" " + func)
|
145
|
+
f.write("\n};\n")
|
146
|
+
if len(self._error_quark_functions) > 0:
|
147
|
+
for func in self._error_quark_functions:
|
148
|
+
f.write("extern GQuark " + func + "(void);\n")
|
149
|
+
f.write("GQuark (*GI_ERROR_QUARK_FUNCS_[])(void) = {\n")
|
150
|
+
first = True
|
151
|
+
for func in self._error_quark_functions:
|
152
|
+
if first:
|
153
|
+
first = False
|
154
|
+
else:
|
155
|
+
f.write(",\n")
|
156
|
+
f.write(" " + func)
|
157
|
+
f.write("\n};\n")
|
158
|
+
|
159
|
+
if self._compiler.compiler.exe_extension:
|
160
|
+
ext = self._compiler.compiler.exe_extension
|
165
161
|
else:
|
166
162
|
ext = ''
|
167
163
|
|
168
164
|
bin_path = self._generate_tempfile(tmpdir, ext)
|
169
165
|
|
170
166
|
try:
|
171
|
-
self._compile(
|
167
|
+
introspection_obj = self._compile(c_path)
|
172
168
|
except CompilerError as e:
|
173
169
|
if not utils.have_debug_flag('save-temps'):
|
174
170
|
shutil.rmtree(tmpdir)
|
175
171
|
raise SystemExit('compilation of temporary binary failed:' + str(e))
|
176
172
|
|
177
173
|
try:
|
178
|
-
self._link(bin_path,
|
174
|
+
self._link(bin_path, introspection_obj)
|
179
175
|
except LinkerError as e:
|
180
176
|
if not utils.have_debug_flag('save-temps'):
|
181
177
|
shutil.rmtree(tmpdir)
|
@@ -193,143 +189,137 @@ class DumpCompiler(object):
|
|
193
189
|
def _run_pkgconfig(self, flag):
|
194
190
|
# Enable the --msvc-syntax pkg-config flag when
|
195
191
|
# the Microsoft compiler is used
|
196
|
-
if self.
|
197
|
-
cmd = [self._pkgconfig_cmd,
|
192
|
+
if self._compiler.check_is_msvc():
|
193
|
+
cmd = [self._pkgconfig_cmd, '--msvc-syntax', flag]
|
198
194
|
else:
|
199
195
|
cmd = [self._pkgconfig_cmd, flag]
|
200
196
|
proc = subprocess.Popen(
|
201
197
|
cmd + self._packages,
|
202
198
|
stdout=subprocess.PIPE)
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
args = self._compiler_cmd.split()
|
208
|
-
# Do not add -Wall when using init code as we do not include any
|
209
|
-
# header of the library being introspected
|
210
|
-
if self._compiler_cmd == 'gcc' and not self._options.init_sections:
|
211
|
-
args.append('-Wall')
|
212
|
-
# The Microsoft compiler uses different option flags for
|
213
|
-
# silencing warnings on deprecated function usage
|
214
|
-
if self._pkgconfig_msvc_flags:
|
215
|
-
args.append("-wd4996")
|
216
|
-
else:
|
217
|
-
args.append("-Wno-deprecated-declarations")
|
199
|
+
out, err = proc.communicate()
|
200
|
+
return out.decode('ascii').split()
|
201
|
+
|
202
|
+
def _compile(self, *sources):
|
218
203
|
pkgconfig_flags = self._run_pkgconfig('--cflags')
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
cflags = os.environ.get('CFLAGS', '')
|
224
|
-
for cflag in cflags.split():
|
225
|
-
args.append(cflag)
|
226
|
-
for include in self._options.cpp_includes:
|
227
|
-
args.append('-I' + include)
|
228
|
-
# The Microsoft compiler uses different option flags for
|
229
|
-
# compilation result output
|
230
|
-
if self._pkgconfig_msvc_flags:
|
231
|
-
args.extend(['-c', '-Fe' + output, '-Fo' + output])
|
232
|
-
else:
|
233
|
-
args.extend(['-c', '-o', output])
|
234
|
-
for source in sources:
|
235
|
-
if not os.path.exists(source):
|
236
|
-
raise CompilerError(
|
237
|
-
"Could not find c source file: %s" % (source, ))
|
238
|
-
args.extend(list(sources))
|
239
|
-
if not self._options.quiet:
|
240
|
-
print "g-ir-scanner: compile: %s" % (
|
241
|
-
subprocess.list2cmdline(args), )
|
242
|
-
sys.stdout.flush()
|
243
|
-
try:
|
244
|
-
subprocess.check_call(args)
|
245
|
-
except subprocess.CalledProcessError as e:
|
246
|
-
raise CompilerError(e)
|
204
|
+
return self._compiler.compile(pkgconfig_flags,
|
205
|
+
self._options.cpp_includes,
|
206
|
+
sources,
|
207
|
+
self._options.init_sections)
|
247
208
|
|
248
|
-
def _link(self, output,
|
209
|
+
def _link(self, output, sources):
|
249
210
|
args = []
|
250
211
|
libtool = utils.get_libtool_command(self._options)
|
251
212
|
if libtool:
|
213
|
+
# Note: MSVC Builds do not use libtool!
|
214
|
+
# In the libtool case, put together the linker command, as we did before.
|
215
|
+
# We aren't using distutils to link in this case.
|
252
216
|
args.extend(libtool)
|
253
217
|
args.append('--mode=link')
|
254
218
|
args.append('--tag=CC')
|
255
219
|
if self._options.quiet:
|
256
220
|
args.append('--silent')
|
257
221
|
|
258
|
-
|
259
|
-
|
260
|
-
# but it is considered deprecated usage with that
|
261
|
-
if self._pkgconfig_msvc_flags:
|
262
|
-
args.extend(['-Fe' + output])
|
263
|
-
else:
|
222
|
+
args.extend(self._linker_cmd)
|
223
|
+
|
264
224
|
args.extend(['-o', output])
|
265
|
-
if libtool:
|
266
225
|
if os.name == 'nt':
|
267
226
|
args.append('-Wl,--export-all-symbols')
|
268
227
|
else:
|
269
228
|
args.append('-export-dynamic')
|
270
229
|
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
230
|
+
if not self._compiler.check_is_msvc():
|
231
|
+
# These envvars are not used for MSVC Builds!
|
232
|
+
# MSVC Builds use the INCLUDE, LIB envvars,
|
233
|
+
# which are automatically picked up during
|
234
|
+
# compilation and linking
|
235
|
+
cppflags = os.environ.get('CPPFLAGS', '')
|
236
|
+
for cppflag in cppflags.split():
|
237
|
+
args.append(cppflag)
|
238
|
+
cflags = os.environ.get('CFLAGS', '')
|
239
|
+
for cflag in cflags.split():
|
240
|
+
args.append(cflag)
|
241
|
+
ldflags = os.environ.get('LDFLAGS', '')
|
242
|
+
for ldflag in ldflags.split():
|
243
|
+
args.append(ldflag)
|
280
244
|
|
281
245
|
# Make sure to list the library to be introspected first since it's
|
282
246
|
# likely to be uninstalled yet and we want the uninstalled RPATHs have
|
283
247
|
# priority (or we might run with installed library that is older)
|
284
|
-
|
285
248
|
for source in sources:
|
286
249
|
if not os.path.exists(source):
|
287
250
|
raise CompilerError(
|
288
251
|
"Could not find object file: %s" % (source, ))
|
289
|
-
args.extend(list(sources))
|
290
252
|
|
291
|
-
|
253
|
+
if libtool:
|
254
|
+
args.extend(sources)
|
255
|
+
|
256
|
+
pkg_config_libs = self._run_pkgconfig('--libs')
|
292
257
|
|
293
258
|
if not self._options.external_library:
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
self._options.namespace_name,
|
300
|
-
self._options.namespace_version)
|
301
|
-
args.extend(self._run_pkgconfig('--libs'))
|
259
|
+
self._compiler.get_internal_link_flags(args,
|
260
|
+
libtool,
|
261
|
+
self._options.libraries,
|
262
|
+
self._options.library_paths)
|
263
|
+
args.extend(pkg_config_libs)
|
302
264
|
|
303
265
|
else:
|
304
|
-
args.extend(
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
if not
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
#
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
266
|
+
args.extend(pkg_config_libs)
|
267
|
+
self._compiler.get_external_link_flags(args,
|
268
|
+
libtool,
|
269
|
+
self._options.libraries)
|
270
|
+
|
271
|
+
if not libtool:
|
272
|
+
# non-libtool: prepare distutils for linking the introspection
|
273
|
+
# dumper program...
|
274
|
+
try:
|
275
|
+
self._compiler.link(output,
|
276
|
+
sources,
|
277
|
+
args)
|
278
|
+
|
279
|
+
# Ignore failing to embed the manifest files, when the manifest
|
280
|
+
# file does not exist, especially for MSVC 2010 and later builds.
|
281
|
+
# If we are on Visual C++ 2005/2008, where
|
282
|
+
# this embedding is required, the build will fail anyway, as
|
283
|
+
# the dumper program will likely fail to run, and this means
|
284
|
+
# something went wrong with the build.
|
285
|
+
except LinkError as e:
|
286
|
+
if self._compiler.check_is_msvc():
|
287
|
+
msg = str(e)
|
288
|
+
|
289
|
+
if msg[msg.rfind('mt.exe'):] == 'mt.exe\' failed with exit status 31':
|
290
|
+
if sys.version_info < (3, 0):
|
291
|
+
sys.exc_clear()
|
292
|
+
pass
|
293
|
+
else:
|
294
|
+
raise LinkError(e)
|
295
|
+
else:
|
296
|
+
raise LinkError(e)
|
297
|
+
else:
|
298
|
+
# libtool: Run the assembled link command, we don't use distutils
|
299
|
+
# for linking here.
|
300
|
+
if not self._options.quiet:
|
301
|
+
print("g-ir-scanner: link: %s" % (
|
302
|
+
subprocess.list2cmdline(args), ))
|
303
|
+
sys.stdout.flush()
|
304
|
+
msys = os.environ.get('MSYSTEM', None)
|
331
305
|
if msys:
|
332
|
-
os.
|
306
|
+
shell = os.environ.get('SHELL', 'sh.exe')
|
307
|
+
# Create a temporary script file that
|
308
|
+
# runs the command we want
|
309
|
+
tf, tf_name = tempfile.mkstemp()
|
310
|
+
with os.fdopen(tf, 'wb') as f:
|
311
|
+
shellcontents = ' '.join([x.replace('\\', '/') for x in args])
|
312
|
+
fcontents = '#!/bin/sh\nunset PWD\n{}\n'.format(shellcontents)
|
313
|
+
f.write(fcontents)
|
314
|
+
shell = utils.which(shell)
|
315
|
+
args = [shell, tf_name.replace('\\', '/')]
|
316
|
+
try:
|
317
|
+
subprocess.check_call(args)
|
318
|
+
except subprocess.CalledProcessError as e:
|
319
|
+
raise LinkerError(e)
|
320
|
+
finally:
|
321
|
+
if msys:
|
322
|
+
os.remove(tf_name)
|
333
323
|
|
334
324
|
|
335
325
|
def compile_introspection_binary(options, get_type_functions,
|