gobject-introspection 3.0.7-x64-mingw32 → 3.0.8-x64-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (126) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +2 -2
  3. data/ext/gobject-introspection/extconf.rb +1 -0
  4. data/ext/gobject-introspection/rb-gi-argument.c +123 -26
  5. data/ext/gobject-introspection/rb-gi-function-info.c +558 -19
  6. data/ext/gobject-introspection/rb-gi-repository.c +9 -0
  7. data/ext/gobject-introspection/rb-gobject-introspection.h +3 -0
  8. data/lib/2.2/gobject_introspection.so +0 -0
  9. data/lib/2.3/gobject_introspection.so +0 -0
  10. data/lib/gobject-introspection/loader.rb +1 -1
  11. data/vendor/local/bin/g-ir-compiler.exe +0 -0
  12. data/vendor/local/bin/g-ir-generate.exe +0 -0
  13. data/vendor/local/bin/libgirepository-1.0-1.dll +0 -0
  14. data/vendor/local/include/gobject-introspection-1.0/gistructinfo.h +4 -0
  15. data/vendor/local/lib/girepository-1.0/GIRepository-2.0.typelib +0 -0
  16. data/vendor/local/lib/girepository-1.0/GLib-2.0.typelib +0 -0
  17. data/vendor/local/lib/girepository-1.0/GModule-2.0.typelib +0 -0
  18. data/vendor/local/lib/girepository-1.0/GObject-2.0.typelib +0 -0
  19. data/vendor/local/lib/girepository-1.0/Gio-2.0.typelib +0 -0
  20. data/vendor/local/lib/gobject-introspection/giscanner/__init__.py +1 -1
  21. data/vendor/local/lib/gobject-introspection/giscanner/__init__.pyc +0 -0
  22. data/vendor/local/lib/gobject-introspection/giscanner/__init__.pyo +0 -0
  23. data/vendor/local/lib/gobject-introspection/giscanner/annotationmain.py +39 -11
  24. data/vendor/local/lib/gobject-introspection/giscanner/annotationmain.pyc +0 -0
  25. data/vendor/local/lib/gobject-introspection/giscanner/annotationmain.pyo +0 -0
  26. data/vendor/local/lib/gobject-introspection/giscanner/annotationparser.py +187 -164
  27. data/vendor/local/lib/gobject-introspection/giscanner/annotationparser.pyc +0 -0
  28. data/vendor/local/lib/gobject-introspection/giscanner/annotationparser.pyo +0 -0
  29. data/vendor/local/lib/gobject-introspection/giscanner/ast.py +191 -58
  30. data/vendor/local/lib/gobject-introspection/giscanner/ast.pyc +0 -0
  31. data/vendor/local/lib/gobject-introspection/giscanner/ast.pyo +0 -0
  32. data/vendor/local/lib/gobject-introspection/giscanner/cachestore.py +42 -54
  33. data/vendor/local/lib/gobject-introspection/giscanner/cachestore.pyc +0 -0
  34. data/vendor/local/lib/gobject-introspection/giscanner/cachestore.pyo +0 -0
  35. data/vendor/local/lib/gobject-introspection/giscanner/ccompiler.py +272 -82
  36. data/vendor/local/lib/gobject-introspection/giscanner/ccompiler.pyc +0 -0
  37. data/vendor/local/lib/gobject-introspection/giscanner/ccompiler.pyo +0 -0
  38. data/vendor/local/lib/gobject-introspection/giscanner/codegen.py +18 -11
  39. data/vendor/local/lib/gobject-introspection/giscanner/codegen.pyc +0 -0
  40. data/vendor/local/lib/gobject-introspection/giscanner/codegen.pyo +0 -0
  41. data/vendor/local/lib/gobject-introspection/giscanner/collections/__init__.py +4 -0
  42. data/vendor/local/lib/gobject-introspection/giscanner/collections/__init__.pyc +0 -0
  43. data/vendor/local/lib/gobject-introspection/giscanner/collections/__init__.pyo +0 -0
  44. data/vendor/local/lib/gobject-introspection/giscanner/collections/counter.pyc +0 -0
  45. data/vendor/local/lib/gobject-introspection/giscanner/collections/counter.pyo +0 -0
  46. data/vendor/local/lib/gobject-introspection/giscanner/collections/ordereddict.py +25 -13
  47. data/vendor/local/lib/gobject-introspection/giscanner/collections/ordereddict.pyc +0 -0
  48. data/vendor/local/lib/gobject-introspection/giscanner/collections/ordereddict.pyo +0 -0
  49. data/vendor/local/lib/gobject-introspection/giscanner/docmain.py +21 -19
  50. data/vendor/local/lib/gobject-introspection/giscanner/docmain.pyc +0 -0
  51. data/vendor/local/lib/gobject-introspection/giscanner/docmain.pyo +0 -0
  52. data/vendor/local/lib/gobject-introspection/giscanner/docwriter.py +19 -16
  53. data/vendor/local/lib/gobject-introspection/giscanner/docwriter.pyc +0 -0
  54. data/vendor/local/lib/gobject-introspection/giscanner/docwriter.pyo +0 -0
  55. data/vendor/local/lib/gobject-introspection/giscanner/dumper.py +148 -158
  56. data/vendor/local/lib/gobject-introspection/giscanner/dumper.pyc +0 -0
  57. data/vendor/local/lib/gobject-introspection/giscanner/dumper.pyo +0 -0
  58. data/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.py +31 -21
  59. data/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyc +0 -0
  60. data/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyo +0 -0
  61. data/vendor/local/lib/gobject-introspection/giscanner/girparser.py +13 -5
  62. data/vendor/local/lib/gobject-introspection/giscanner/girparser.pyc +0 -0
  63. data/vendor/local/lib/gobject-introspection/giscanner/girparser.pyo +0 -0
  64. data/vendor/local/lib/gobject-introspection/giscanner/girwriter.py +12 -13
  65. data/vendor/local/lib/gobject-introspection/giscanner/girwriter.pyc +0 -0
  66. data/vendor/local/lib/gobject-introspection/giscanner/girwriter.pyo +0 -0
  67. data/vendor/local/lib/gobject-introspection/giscanner/introspectablepass.py +5 -1
  68. data/vendor/local/lib/gobject-introspection/giscanner/introspectablepass.pyc +0 -0
  69. data/vendor/local/lib/gobject-introspection/giscanner/introspectablepass.pyo +0 -0
  70. data/vendor/local/lib/gobject-introspection/giscanner/libtoolimporter.py +11 -9
  71. data/vendor/local/lib/gobject-introspection/giscanner/libtoolimporter.pyc +0 -0
  72. data/vendor/local/lib/gobject-introspection/giscanner/libtoolimporter.pyo +0 -0
  73. data/vendor/local/lib/gobject-introspection/giscanner/maintransformer.py +150 -45
  74. data/vendor/local/lib/gobject-introspection/giscanner/maintransformer.pyc +0 -0
  75. data/vendor/local/lib/gobject-introspection/giscanner/maintransformer.pyo +0 -0
  76. data/vendor/local/lib/gobject-introspection/giscanner/message.py +56 -19
  77. data/vendor/local/lib/gobject-introspection/giscanner/message.pyc +0 -0
  78. data/vendor/local/lib/gobject-introspection/giscanner/message.pyo +0 -0
  79. data/vendor/local/lib/gobject-introspection/giscanner/msvccompiler.py +101 -0
  80. data/vendor/local/lib/gobject-introspection/giscanner/msvccompiler.pyc +0 -0
  81. data/vendor/local/lib/gobject-introspection/giscanner/msvccompiler.pyo +0 -0
  82. data/vendor/local/lib/gobject-introspection/giscanner/scannermain.py +41 -22
  83. data/vendor/local/lib/gobject-introspection/giscanner/scannermain.pyc +0 -0
  84. data/vendor/local/lib/gobject-introspection/giscanner/scannermain.pyo +0 -0
  85. data/vendor/local/lib/gobject-introspection/giscanner/sectionparser.py +6 -1
  86. data/vendor/local/lib/gobject-introspection/giscanner/sectionparser.pyc +0 -0
  87. data/vendor/local/lib/gobject-introspection/giscanner/sectionparser.pyo +0 -0
  88. data/vendor/local/lib/gobject-introspection/giscanner/shlibs.py +8 -2
  89. data/vendor/local/lib/gobject-introspection/giscanner/shlibs.pyc +0 -0
  90. data/vendor/local/lib/gobject-introspection/giscanner/shlibs.pyo +0 -0
  91. data/vendor/local/lib/gobject-introspection/giscanner/sourcescanner.py +42 -56
  92. data/vendor/local/lib/gobject-introspection/giscanner/sourcescanner.pyc +0 -0
  93. data/vendor/local/lib/gobject-introspection/giscanner/sourcescanner.pyo +0 -0
  94. data/vendor/local/lib/gobject-introspection/giscanner/testcodegen.py +19 -5
  95. data/vendor/local/lib/gobject-introspection/giscanner/testcodegen.pyc +0 -0
  96. data/vendor/local/lib/gobject-introspection/giscanner/testcodegen.pyo +0 -0
  97. data/vendor/local/lib/gobject-introspection/giscanner/transformer.py +73 -37
  98. data/vendor/local/lib/gobject-introspection/giscanner/transformer.pyc +0 -0
  99. data/vendor/local/lib/gobject-introspection/giscanner/transformer.pyo +0 -0
  100. data/vendor/local/lib/gobject-introspection/giscanner/utils.py +92 -14
  101. data/vendor/local/lib/gobject-introspection/giscanner/utils.pyc +0 -0
  102. data/vendor/local/lib/gobject-introspection/giscanner/utils.pyo +0 -0
  103. data/vendor/local/lib/gobject-introspection/giscanner/xmlwriter.py +30 -11
  104. data/vendor/local/lib/gobject-introspection/giscanner/xmlwriter.pyc +0 -0
  105. data/vendor/local/lib/gobject-introspection/giscanner/xmlwriter.pyo +0 -0
  106. data/vendor/local/lib/libgirepository-1.0.a +0 -0
  107. data/vendor/local/lib/libgirepository-1.0.dll.a +0 -0
  108. data/vendor/local/lib/libgirepository-1.0.la +1 -1
  109. data/vendor/local/lib/pkgconfig/gobject-introspection-1.0.pc +1 -1
  110. data/vendor/local/lib/pkgconfig/gobject-introspection-no-export-1.0.pc +1 -1
  111. data/vendor/local/share/gir-1.0/GIRepository-2.0.gir +57 -13
  112. data/vendor/local/share/gir-1.0/GLib-2.0.gir +2017 -893
  113. data/vendor/local/share/gir-1.0/GModule-2.0.gir +2 -1
  114. data/vendor/local/share/gir-1.0/GObject-2.0.gir +1107 -674
  115. data/vendor/local/share/gir-1.0/Gio-2.0.gir +5589 -1287
  116. data/vendor/local/share/gobject-introspection-1.0/Makefile.introspection +4 -2
  117. data/vendor/local/share/gobject-introspection-1.0/gdump.c +8 -0
  118. data/vendor/local/share/gobject-introspection-1.0/tests/everything.c +273 -323
  119. data/vendor/local/share/gobject-introspection-1.0/tests/everything.h +58 -38
  120. data/vendor/local/share/gobject-introspection-1.0/tests/gimarshallingtests.c +1 -1
  121. data/vendor/local/share/gobject-introspection-1.0/tests/regress.c +177 -23
  122. data/vendor/local/share/gobject-introspection-1.0/tests/regress.h +40 -0
  123. data/vendor/local/share/man/man1/g-ir-compiler.1 +7 -7
  124. metadata +9 -7
  125. data/lib/2.0/gobject_introspection.so +0 -0
  126. data/lib/2.1/gobject_introspection.so +0 -0
@@ -19,12 +19,17 @@
19
19
  # 02110-1301, 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 platform
24
29
  import re
25
30
  import subprocess
26
31
 
27
- from .utils import get_libtool_command, extract_libtool_shlib, which
32
+ from .utils import get_libtool_command, extract_libtool_shlib
28
33
  from .ccompiler import CCompiler
29
34
 
30
35
 
@@ -111,7 +116,8 @@ def _resolve_non_libtool(options, binary, libraries):
111
116
 
112
117
  shlibs = []
113
118
  for line in proc.stdout:
114
- for library, pattern in patterns.iteritems():
119
+ line = line.decode('ascii')
120
+ for library, pattern in patterns.items():
115
121
  m = pattern.search(line)
116
122
  if m:
117
123
  del patterns[library]
@@ -19,12 +19,18 @@
19
19
  #
20
20
 
21
21
  from __future__ import with_statement
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 subprocess
24
29
  import tempfile
25
30
 
26
31
  from .libtoolimporter import LibtoolImporter
27
32
  from .message import Position
33
+ from .ccompiler import CCompiler
28
34
 
29
35
  with LibtoolImporter(None, None):
30
36
  if 'UNINSTALLED_INTROSPECTION_SRCDIR' in os.environ:
@@ -119,7 +125,7 @@ class SourceType(object):
119
125
  self._stype = stype
120
126
 
121
127
  def __repr__(self):
122
- return '<%s type=%r name=%r>' % (
128
+ return "<%s type='%s' name='%s'>" % (
123
129
  self.__class__.__name__,
124
130
  ctype_name(self.type),
125
131
  self.name)
@@ -166,8 +172,8 @@ class SourceSymbol(object):
166
172
  if src:
167
173
  line = self.line
168
174
  if line:
169
- src += ':%r' % (line, )
170
- return '<%s type=%r ident=%r src=%r>' % (
175
+ src += ":'%s'" % (line, )
176
+ return "<%s type='%s' ident='%s' src='%s'>" % (
171
177
  self.__class__.__name__,
172
178
  symbol_type_name(self.type),
173
179
  self.ident,
@@ -236,7 +242,7 @@ class SourceScanner(object):
236
242
  ('-U', undefines)]:
237
243
  for arg in (args or []):
238
244
  opt = prefix + arg
239
- if not opt in self._cpp_options:
245
+ if opt not in self._cpp_options:
240
246
  self._cpp_options.append(opt)
241
247
 
242
248
  def parse_files(self, filenames):
@@ -269,9 +275,9 @@ class SourceScanner(object):
269
275
  return self._scanner.get_comments()
270
276
 
271
277
  def dump(self):
272
- print '-' * 30
278
+ print('-' * 30)
273
279
  for symbol in self._scanner.get_symbols():
274
- print symbol.ident, symbol.base_type.name, symbol.type
280
+ print(symbol.ident, symbol.base_type.name, symbol.type)
275
281
 
276
282
  # Private
277
283
 
@@ -281,57 +287,37 @@ class SourceScanner(object):
281
287
 
282
288
  defines = ['__GI_SCANNER__']
283
289
  undefs = []
284
- cpp_args = os.environ.get('CC', 'cc').split() # support CC="ccache gcc"
285
- if 'cl' in cpp_args:
286
- # The Microsoft compiler/preprocessor (cl) does not accept
287
- # source input from stdin (the '-' flag), so we need
288
- # some help from gcc from MinGW/Cygwin or so.
289
- # Note that the generated dumper program is
290
- # still built and linked by Visual C++.
291
- cpp_args = ['gcc']
292
- cpp_args += os.environ.get('CPPFLAGS', '').split()
293
- cpp_args += os.environ.get('CFLAGS', '').split()
294
- cpp_args += ['-E', '-C', '-I.', '-']
295
- cpp_args += self._cpp_options
296
-
297
- # We expect the preprocessor to remove macros. If debugging is turned
298
- # up high enough that won't happen, so strip these out. Bug #720504
299
- for flag in ['-g3', '-ggdb3', '-gstabs3', '-gcoff3', '-gxcoff3', '-gvms3']:
300
- try:
301
- cpp_args.remove(flag)
302
- except ValueError:
303
- pass
304
-
305
- proc = subprocess.Popen(cpp_args,
306
- stdin=subprocess.PIPE,
307
- stdout=subprocess.PIPE)
308
290
 
309
- for define in defines:
310
- proc.stdin.write('#ifndef %s\n' % (define, ))
311
- proc.stdin.write('# define %s\n' % (define, ))
312
- proc.stdin.write('#endif\n')
313
- for undef in undefs:
314
- proc.stdin.write('#undef %s\n' % (undef, ))
315
- for filename in filenames:
316
- proc.stdin.write('#include <%s>\n' % (filename, ))
317
- proc.stdin.close()
318
-
319
- tmp_fd, tmp_name = tempfile.mkstemp()
320
- fp = os.fdopen(tmp_fd, 'w+b')
321
- while True:
322
- data = proc.stdout.read(4096)
323
- if data is None:
324
- break
325
- fp.write(data)
326
- if len(data) < 4096:
327
- break
328
- fp.seek(0, 0)
329
-
330
- assert proc, 'Proc was none'
331
- proc.wait()
332
- if proc.returncode != 0:
333
- raise SystemExit('Error while processing the source.')
291
+ cc = CCompiler()
292
+
293
+ tmp_fd_cpp, tmp_name_cpp = tempfile.mkstemp(prefix='g-ir-cpp-', suffix='.c')
294
+ with os.fdopen(tmp_fd_cpp, 'wb') as fp_cpp:
295
+ self._write_preprocess_src(fp_cpp, defines, undefs, filenames)
296
+
297
+ tmpfile_basename = os.path.basename(os.path.splitext(tmp_name_cpp)[0])
298
+
299
+ # Output file name of the preprocessor, only really used on non-MSVC,
300
+ # so we want the name to match the output file name of the MSVC preprocessor
301
+ tmpfile_output = tmpfile_basename + '.i'
302
+
303
+ cc.preprocess(tmp_name_cpp,
304
+ tmpfile_output,
305
+ self._cpp_options)
306
+
307
+ os.unlink(tmp_name_cpp)
308
+ fp = open(tmpfile_output, 'r')
334
309
 
335
310
  self._scanner.parse_file(fp.fileno())
336
311
  fp.close()
337
- os.unlink(tmp_name)
312
+ os.unlink(tmpfile_output)
313
+
314
+ def _write_preprocess_src(self, fp, defines, undefs, filenames):
315
+ # Write to the temp file for feeding into the preprocessor
316
+ for define in defines:
317
+ fp.write(('#ifndef %s\n' % (define, )).encode())
318
+ fp.write(('# define %s\n' % (define, )).encode())
319
+ fp.write('#endif\n'.encode())
320
+ for undef in undefs:
321
+ fp.write(('#undef %s\n' % (undef, )).encode())
322
+ for filename in filenames:
323
+ fp.write(('#include <%s>\n' % (filename, )).encode())
@@ -18,10 +18,21 @@
18
18
  # Boston, MA 02111-1307, USA.
19
19
  #
20
20
 
21
- from StringIO import StringIO
21
+ from __future__ import absolute_import
22
+ from __future__ import division
23
+ from __future__ import print_function
24
+ from __future__ import unicode_literals
25
+
26
+ import sys
27
+
22
28
  from . import ast
23
29
  from .codegen import CCodeGenerator
24
30
 
31
+ if sys.version_info.major < 3:
32
+ from StringIO import StringIO
33
+ else:
34
+ from io import StringIO
35
+
25
36
  DEFAULT_C_VALUES = {ast.TYPE_ANY: 'NULL',
26
37
  ast.TYPE_STRING: '""',
27
38
  ast.TYPE_FILENAME: '""',
@@ -65,6 +76,9 @@ class EverythingCodeGenerator(object):
65
76
  include_last_src)
66
77
 
67
78
  def write(self):
79
+ types = [ast.TYPE_ANY]
80
+ types.extend(ast.INTROSPECTABLE_BASIC)
81
+
68
82
  func = ast.Function('nullfunc',
69
83
  ast.Return(ast.TYPE_NONE, transfer=ast.PARAM_TRANSFER_NONE),
70
84
  [], False, self.gen.gen_symbol('nullfunc'))
@@ -74,7 +88,7 @@ class EverythingCodeGenerator(object):
74
88
 
75
89
  # First pass, generate constant returns
76
90
  prefix = 'const return '
77
- for typeval in ast.INTROSPECTABLE_BASIC:
91
+ for typeval in types:
78
92
  name = prefix + uscore_from_type(typeval)
79
93
  sym = self.gen.gen_symbol(name)
80
94
  func = ast.Function(name,
@@ -87,7 +101,7 @@ class EverythingCodeGenerator(object):
87
101
 
88
102
  # Void return, one parameter
89
103
  prefix = 'oneparam '
90
- for typeval in ast.INTROSPECTABLE_BASIC:
104
+ for typeval in types:
91
105
  if typeval is ast.TYPE_NONE:
92
106
  continue
93
107
  name = prefix + uscore_from_type(typeval)
@@ -101,7 +115,7 @@ class EverythingCodeGenerator(object):
101
115
 
102
116
  # Void return, one (out) parameter
103
117
  prefix = 'one_outparam '
104
- for typeval in ast.INTROSPECTABLE_BASIC:
118
+ for typeval in types:
105
119
  if typeval is ast.TYPE_NONE:
106
120
  continue
107
121
  name = prefix + uscore_from_type(typeval)
@@ -119,7 +133,7 @@ class EverythingCodeGenerator(object):
119
133
 
120
134
  # Passthrough one parameter
121
135
  prefix = 'passthrough_one '
122
- for typeval in ast.INTROSPECTABLE_BASIC:
136
+ for typeval in types:
123
137
  if typeval is ast.TYPE_NONE:
124
138
  continue
125
139
  name = prefix + uscore_from_type(typeval)
@@ -18,12 +18,18 @@
18
18
  # Boston, MA 02111-1307, 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
27
  import sys
23
28
  import subprocess
24
29
 
25
30
  from . import ast
26
31
  from . import message
32
+ from . import utils
27
33
  from .cachestore import CacheStore
28
34
  from .girparser import GIRParser
29
35
  from .sourcescanner import (
@@ -40,17 +46,11 @@ class TransformerException(Exception):
40
46
  pass
41
47
 
42
48
 
43
- _xdg_data_dirs = [x for x in os.environ.get('XDG_DATA_DIRS', '').split(os.pathsep)]
44
- _xdg_data_dirs.append(DATADIR)
45
-
46
- if os.name != 'nt':
47
- _xdg_data_dirs.append('/usr/share')
48
-
49
-
50
49
  class Transformer(object):
51
50
  namespace = property(lambda self: self._namespace)
52
51
 
53
- def __init__(self, namespace, accept_unprefixed=False, identifier_filter_cmd=''):
52
+ def __init__(self, namespace, accept_unprefixed=False,
53
+ identifier_filter_cmd='', symbol_filter_cmd=''):
54
54
  self._cachestore = CacheStore()
55
55
  self._accept_unprefixed = accept_unprefixed
56
56
  self._namespace = namespace
@@ -60,6 +60,7 @@ class Transformer(object):
60
60
  self._includepaths = []
61
61
  self._passthrough_mode = False
62
62
  self._identifier_filter_cmd = identifier_filter_cmd
63
+ self._symbol_filter_cmd = symbol_filter_cmd
63
64
 
64
65
  # Cache a list of struct/unions in C's "tag namespace". This helps
65
66
  # manage various orderings of typedefs and structs. See:
@@ -100,7 +101,7 @@ class Transformer(object):
100
101
 
101
102
  def parse(self, symbols):
102
103
  for symbol in symbols:
103
- ## WORKAROUND ##
104
+ # WORKAROUND
104
105
  # https://bugzilla.gnome.org/show_bug.cgi?id=550616
105
106
  if symbol.ident in ['gst_g_error_get_type']:
106
107
  continue
@@ -120,7 +121,7 @@ class Transformer(object):
120
121
  # Run through the tag namespace looking for structs that have not been
121
122
  # promoted into the main namespace. In this case we simply promote them
122
123
  # with their struct tag.
123
- for tag_name, struct in self._tag_ns.iteritems():
124
+ for tag_name, struct in self._tag_ns.items():
124
125
  if not struct.name:
125
126
  try:
126
127
  name = self.strip_identifier(tag_name)
@@ -142,7 +143,7 @@ class Transformer(object):
142
143
  def register_include_uninstalled(self, include_path):
143
144
  basename = os.path.basename(include_path)
144
145
  if not basename.endswith('.gir'):
145
- raise SystemExit("Include path %r must be a filename path "
146
+ raise SystemExit("Include path '%s' must be a filename path "
146
147
  "ending in .gir" % (include_path, ))
147
148
  girname = basename[:-4]
148
149
  include = ast.Include.from_string(girname)
@@ -163,7 +164,7 @@ namespaces."""
163
164
  if ns == self._namespace.name:
164
165
  return self._namespace.get(giname)
165
166
  # Fallback to the main namespace if not a dependency and matches a prefix
166
- if ns in self._namespace.identifier_prefixes and not ns in self._parsed_includes:
167
+ if ns in self._namespace.identifier_prefixes and ns not in self._parsed_includes:
167
168
  message.warn(("Deprecated reference to identifier " +
168
169
  "prefix %s in GIName %s") % (ns, name))
169
170
  return self._namespace.get(giname)
@@ -180,9 +181,17 @@ None."""
180
181
 
181
182
  # Private
182
183
 
184
+ def _get_gi_data_dirs(self):
185
+ data_dirs = utils.get_system_data_dirs()
186
+ data_dirs.append(DATADIR)
187
+ if os.name != 'nt':
188
+ # For backwards compatibility, was always unconditionally added to the list.
189
+ data_dirs.append('/usr/share')
190
+ return data_dirs
191
+
183
192
  def _find_include(self, include):
184
193
  searchdirs = self._includepaths[:]
185
- for path in _xdg_data_dirs:
194
+ for path in self._get_gi_data_dirs():
186
195
  searchdirs.append(os.path.join(path, 'gir-1.0'))
187
196
  searchdirs.append(os.path.join(DATADIR, 'gir-1.0'))
188
197
 
@@ -191,7 +200,8 @@ None."""
191
200
  path = os.path.join(d, girname)
192
201
  if os.path.exists(path):
193
202
  return path
194
- sys.stderr.write("Couldn't find include %r (search path: %r)\n" % (girname, searchdirs))
203
+ sys.stderr.write("Couldn't find include '%s' (search path: '%s')\n" %
204
+ (girname, searchdirs))
195
205
  sys.exit(1)
196
206
 
197
207
  @classmethod
@@ -200,8 +210,7 @@ None."""
200
210
  if extra_include_dirs is not None:
201
211
  self.set_include_paths(extra_include_dirs)
202
212
  self.set_passthrough_mode()
203
- self._parse_include(filename)
204
- parser = self._cachestore.load(filename)
213
+ parser = self._parse_include(filename)
205
214
  self._namespace = parser.get_namespace()
206
215
  del self._parsed_includes[self._namespace.name]
207
216
  return self
@@ -226,22 +235,39 @@ None."""
226
235
  self._pkg_config_packages.add(pkg)
227
236
  namespace = parser.get_namespace()
228
237
  self._parsed_includes[namespace.name] = namespace
238
+ return parser
229
239
 
230
240
  def _iter_namespaces(self):
231
241
  """Return an iterator over all included namespaces; the
232
242
  currently-scanned namespace is first."""
233
243
  yield self._namespace
234
- for ns in self._parsed_includes.itervalues():
244
+ for ns in self._parsed_includes.values():
235
245
  yield ns
236
246
 
237
- def _sort_matches(self, x, y):
238
- if x[0] is self._namespace:
239
- return 1
240
- elif y[0] is self._namespace:
241
- return -1
242
- return cmp(x[2], y[2])
247
+ def _sort_matches(self, val):
248
+ """Key sort which ensures items in self._namespace are last by returning
249
+ a tuple key starting with 1 for self._namespace entries and 0 for
250
+ everythin else.
251
+ """
252
+ if val[0] == self._namespace:
253
+ return 1, val[2]
254
+ else:
255
+ return 0, val[2]
243
256
 
244
257
  def _split_c_string_for_namespace_matches(self, name, is_identifier=False):
258
+ if not is_identifier and self._symbol_filter_cmd:
259
+ proc = subprocess.Popen(self._symbol_filter_cmd,
260
+ stdin=subprocess.PIPE,
261
+ stdout=subprocess.PIPE,
262
+ stderr=subprocess.PIPE,
263
+ shell=True)
264
+ _name = name
265
+ proc_name, err = proc.communicate(name.encode())
266
+ if proc.returncode:
267
+ raise ValueError('filter: "%s" exited: %d with error: %s' %
268
+ (self._symbol_filter_cmd, proc.returncode, err))
269
+ name = proc_name.decode('ascii')
270
+
245
271
  matches = [] # Namespaces which might contain this name
246
272
  unprefixed_namespaces = [] # Namespaces with no prefix, last resort
247
273
  for ns in self._iter_namespaces():
@@ -261,8 +287,8 @@ currently-scanned namespace is first."""
261
287
  else:
262
288
  unprefixed_namespaces.append(ns)
263
289
  if matches:
264
- matches.sort(self._sort_matches)
265
- return map(lambda x: (x[0], x[1]), matches)
290
+ matches.sort(key=self._sort_matches)
291
+ return list(map(lambda x: (x[0], x[1]), matches))
266
292
  elif self._accept_unprefixed:
267
293
  return [(self._namespace, name)]
268
294
  elif unprefixed_namespaces:
@@ -272,7 +298,7 @@ currently-scanned namespace is first."""
272
298
  for ns in unprefixed_namespaces:
273
299
  if name in ns:
274
300
  return [(ns, name)]
275
- raise ValueError("Unknown namespace for %s %r"
301
+ raise ValueError("Unknown namespace for %s '%s'"
276
302
  % ('identifier' if is_identifier else 'symbol', name, ))
277
303
 
278
304
  def split_ctype_namespaces(self, ident):
@@ -301,10 +327,11 @@ raise ValueError."""
301
327
  stdout=subprocess.PIPE,
302
328
  stderr=subprocess.PIPE,
303
329
  shell=True)
304
- ident, err = proc.communicate(ident)
330
+ proc_ident, err = proc.communicate(ident.encode())
305
331
  if proc.returncode:
306
332
  raise ValueError('filter: "%s" exited: %d with error: %s' %
307
333
  (self._identifier_filter_cmd, proc.returncode, err))
334
+ ident = proc_ident.decode('ascii')
308
335
 
309
336
  hidden = ident.startswith('_')
310
337
  if hidden:
@@ -320,7 +347,7 @@ raise ValueError."""
320
347
  return name
321
348
  (ns, name) = matches[-1]
322
349
  raise TransformerException(
323
- "Skipping foreign identifier %r from namespace %s" % (ident, ns.name, ))
350
+ "Skipping foreign identifier '%s' from namespace %s" % (ident, ns.name, ))
324
351
  return None
325
352
 
326
353
  def _strip_symbol(self, symbol):
@@ -362,7 +389,7 @@ raise ValueError."""
362
389
  elif stype == CSYMBOL_TYPE_OBJECT:
363
390
  pass
364
391
  else:
365
- print 'transformer: unhandled symbol: %r' % (symbol, )
392
+ print("transformer: unhandled symbol: '%s'" % (symbol, ))
366
393
 
367
394
  def _enum_common_prefix(self, symbol):
368
395
  def common_prefix(a, b):
@@ -486,8 +513,6 @@ raise ValueError."""
486
513
  return value
487
514
 
488
515
  def _create_parameters(self, symbol, base_type):
489
- # warn if we see annotations for unknown parameters
490
- param_names = set(child.ident for child in base_type.child_list)
491
516
  for i, child in enumerate(base_type.child_list):
492
517
  yield self._create_parameter(symbol, i, child)
493
518
 
@@ -573,6 +598,8 @@ raise ValueError."""
573
598
  ctype = symbol.base_type.type
574
599
  if (ctype == CTYPE_POINTER and symbol.base_type.base_type.type == CTYPE_FUNCTION):
575
600
  node = self._create_typedef_callback(symbol)
601
+ elif (ctype == CTYPE_FUNCTION):
602
+ node = self._create_typedef_callback(symbol)
576
603
  elif (ctype == CTYPE_POINTER and symbol.base_type.base_type.type == CTYPE_STRUCT):
577
604
  node = self._create_typedef_compound(ast.Record, symbol, disguised=True)
578
605
  elif ctype == CTYPE_STRUCT:
@@ -594,10 +621,13 @@ raise ValueError."""
594
621
  target = ast.TYPE_ANY
595
622
  if name in ast.type_names:
596
623
  return None
624
+ # https://bugzilla.gnome.org/show_bug.cgi?id=755882
625
+ if name.endswith('_autoptr'):
626
+ return None
597
627
  return ast.Alias(name, target, ctype=symbol.ident)
598
628
  else:
599
629
  raise NotImplementedError(
600
- "symbol %r of type %s" % (symbol.ident, ctype_name(ctype)))
630
+ "symbol '%s' of type %s" % (symbol.ident, ctype_name(ctype)))
601
631
  return node
602
632
 
603
633
  def _canonicalize_ctype(self, ctype):
@@ -711,7 +741,7 @@ raise ValueError."""
711
741
  name = self._strip_symbol(symbol)
712
742
  if symbol.const_string is not None:
713
743
  typeval = ast.TYPE_STRING
714
- value = unicode(symbol.const_string, 'utf-8')
744
+ value = symbol.const_string
715
745
  elif symbol.const_int is not None:
716
746
  if symbol.base_type is not None:
717
747
  typeval = self._create_type_from_base(symbol.base_type)
@@ -845,8 +875,14 @@ raise ValueError."""
845
875
  compound.fields.append(field)
846
876
 
847
877
  def _create_callback(self, symbol, member=False):
848
- parameters = list(self._create_parameters(symbol, symbol.base_type.base_type))
849
- retval = self._create_return(symbol.base_type.base_type.base_type)
878
+ if (symbol.base_type.type == CTYPE_FUNCTION): # function
879
+ paramtype = symbol.base_type
880
+ retvaltype = symbol.base_type.base_type
881
+ elif (symbol.base_type.type == CTYPE_POINTER): # function pointer
882
+ paramtype = symbol.base_type.base_type
883
+ retvaltype = symbol.base_type.base_type.base_type
884
+ parameters = list(self._create_parameters(symbol, paramtype))
885
+ retval = self._create_return(retvaltype)
850
886
 
851
887
  # Mark the 'user_data' arguments
852
888
  for i, param in enumerate(parameters):
@@ -892,7 +928,7 @@ Note that type resolution may not succeed."""
892
928
  # which has nominal namespace of "Meta", but a few classes are
893
929
  # "Mutter". We don't export that data in introspection currently.
894
930
  # Basically the library should be fixed, but we'll hack around it here.
895
- for namespace in self._parsed_includes.itervalues():
931
+ for namespace in self._parsed_includes.values():
896
932
  target = namespace.get_by_ctype(pointer_stripped)
897
933
  if target:
898
934
  typeval.target_giname = '%s.%s' % (namespace.name, target.name)
@@ -965,7 +1001,7 @@ Note that type resolution may not succeed."""
965
1001
  if typenode.target.target_giname is not None:
966
1002
  typenode = self.lookup_giname(typenode.target.target_giname)
967
1003
  elif typenode.target.target_fundamental is not None:
968
- typenode = ast.type_names[typenode.target.target_fundamental]
1004
+ typenode = typenode.target
969
1005
  else:
970
1006
  break
971
1007
  return typenode