gobject-introspection 2.2.0-x86-mingw32 → 2.2.1-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (176) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +7 -7
  3. data/ext/gobject-introspection/rb-gi-argument.c +28 -3
  4. data/ext/gobject-introspection/rb-gi-constructor-info.c +6 -1
  5. data/ext/gobject-introspection/rb-gi-function-info.c +29 -4
  6. data/ext/gobject-introspection/rb-gi-loader.c +19 -3
  7. data/ext/gobject-introspection/rb-gi-struct-info.c +28 -16
  8. data/lib/2.0/gobject_introspection.so +0 -0
  9. data/lib/gobject-introspection/callable-info.rb +16 -7
  10. data/lib/gobject-introspection/loader.rb +47 -19
  11. data/test/test-object-info.rb +1 -1
  12. data/test/test-signal-info.rb +2 -2
  13. data/test/test-struct-info.rb +1 -1
  14. data/vendor/local/bin/g-ir-compiler.exe +0 -0
  15. data/vendor/local/bin/g-ir-generate.exe +0 -0
  16. data/vendor/local/bin/libgirepository-1.0-1.dll +0 -0
  17. data/vendor/local/include/gobject-introspection-1.0/giarginfo.h +30 -0
  18. data/vendor/local/include/gobject-introspection-1.0/gibaseinfo.h +31 -0
  19. data/vendor/local/include/gobject-introspection-1.0/gicallableinfo.h +36 -0
  20. data/vendor/local/include/gobject-introspection-1.0/giconstantinfo.h +12 -0
  21. data/vendor/local/include/gobject-introspection-1.0/gienuminfo.h +26 -0
  22. data/vendor/local/include/gobject-introspection-1.0/gifieldinfo.h +19 -0
  23. data/vendor/local/include/gobject-introspection-1.0/gifunctioninfo.h +23 -0
  24. data/vendor/local/include/gobject-introspection-1.0/giinterfaceinfo.h +38 -0
  25. data/vendor/local/include/gobject-introspection-1.0/giobjectinfo.h +72 -2
  26. data/vendor/local/include/gobject-introspection-1.0/gipropertyinfo.h +12 -0
  27. data/vendor/local/include/gobject-introspection-1.0/giregisteredtypeinfo.h +11 -0
  28. data/vendor/local/include/gobject-introspection-1.0/girepository.h +68 -8
  29. data/vendor/local/include/gobject-introspection-1.0/girffi.h +25 -1
  30. data/vendor/local/include/gobject-introspection-1.0/gisignalinfo.h +12 -0
  31. data/vendor/local/include/gobject-introspection-1.0/gistructinfo.h +24 -0
  32. data/vendor/local/include/gobject-introspection-1.0/gitypeinfo.h +31 -0
  33. data/vendor/local/include/gobject-introspection-1.0/gitypelib.h +25 -0
  34. data/vendor/local/include/gobject-introspection-1.0/gitypes.h +84 -13
  35. data/vendor/local/include/gobject-introspection-1.0/giunioninfo.h +27 -0
  36. data/vendor/local/include/gobject-introspection-1.0/giversionmacros.h +128 -0
  37. data/vendor/local/include/gobject-introspection-1.0/givfuncinfo.h +17 -0
  38. data/vendor/local/lib/girepository-1.0/GIRepository-2.0.typelib +0 -0
  39. data/vendor/local/lib/girepository-1.0/GLib-2.0.typelib +0 -0
  40. data/vendor/local/lib/girepository-1.0/GObject-2.0.typelib +0 -0
  41. data/vendor/local/lib/girepository-1.0/Gio-2.0.typelib +0 -0
  42. data/vendor/local/lib/girepository-1.0/libxml2-2.0.typelib +0 -0
  43. data/vendor/local/lib/girepository-1.0/win32-1.0.typelib +0 -0
  44. data/vendor/local/lib/gobject-introspection/giscanner/__init__.pyc +0 -0
  45. data/vendor/local/lib/gobject-introspection/giscanner/__init__.pyo +0 -0
  46. data/vendor/local/lib/gobject-introspection/giscanner/annotationmain.py +5 -4
  47. data/vendor/local/lib/gobject-introspection/giscanner/annotationmain.pyc +0 -0
  48. data/vendor/local/lib/gobject-introspection/giscanner/annotationmain.pyo +0 -0
  49. data/vendor/local/lib/gobject-introspection/giscanner/annotationparser.py +1865 -913
  50. data/vendor/local/lib/gobject-introspection/giscanner/annotationparser.pyc +0 -0
  51. data/vendor/local/lib/gobject-introspection/giscanner/annotationparser.pyo +0 -0
  52. data/vendor/local/lib/gobject-introspection/giscanner/ast.py +49 -16
  53. data/vendor/local/lib/gobject-introspection/giscanner/ast.pyc +0 -0
  54. data/vendor/local/lib/gobject-introspection/giscanner/ast.pyo +0 -0
  55. data/vendor/local/lib/gobject-introspection/giscanner/cachestore.py +10 -4
  56. data/vendor/local/lib/gobject-introspection/giscanner/cachestore.pyc +0 -0
  57. data/vendor/local/lib/gobject-introspection/giscanner/cachestore.pyo +0 -0
  58. data/vendor/local/lib/gobject-introspection/giscanner/ccompiler.py +202 -0
  59. data/vendor/local/lib/gobject-introspection/giscanner/ccompiler.pyc +0 -0
  60. data/vendor/local/lib/gobject-introspection/giscanner/ccompiler.pyo +0 -0
  61. data/vendor/local/lib/gobject-introspection/giscanner/codegen.py +32 -1
  62. data/vendor/local/lib/gobject-introspection/giscanner/codegen.pyc +0 -0
  63. data/vendor/local/lib/gobject-introspection/giscanner/codegen.pyo +0 -0
  64. data/vendor/local/lib/gobject-introspection/giscanner/collections/__init__.py +1 -0
  65. data/vendor/local/lib/gobject-introspection/giscanner/collections/__init__.pyc +0 -0
  66. data/vendor/local/lib/gobject-introspection/giscanner/collections/__init__.pyo +0 -0
  67. data/vendor/local/lib/gobject-introspection/giscanner/collections/counter.py +305 -0
  68. data/vendor/local/lib/gobject-introspection/giscanner/collections/counter.pyc +0 -0
  69. data/vendor/local/lib/gobject-introspection/giscanner/collections/counter.pyo +0 -0
  70. data/vendor/local/lib/gobject-introspection/giscanner/collections/ordereddict.pyc +0 -0
  71. data/vendor/local/lib/gobject-introspection/giscanner/collections/ordereddict.pyo +0 -0
  72. data/vendor/local/lib/gobject-introspection/giscanner/docmain.pyc +0 -0
  73. data/vendor/local/lib/gobject-introspection/giscanner/docmain.pyo +0 -0
  74. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/C/callback.tmpl +4 -0
  75. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/C/field.tmpl +1 -0
  76. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/C/function.tmpl +8 -9
  77. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/C/interface.tmpl +2 -0
  78. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Gjs/callback.tmpl +27 -0
  79. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Gjs/class.tmpl +17 -5
  80. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Gjs/enum.tmpl +8 -0
  81. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Gjs/field.tmpl +9 -0
  82. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Gjs/function.tmpl +12 -13
  83. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Gjs/interface.tmpl +17 -0
  84. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Gjs/property.tmpl +3 -4
  85. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Gjs/signal.tmpl +10 -9
  86. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Gjs/vfunc.tmpl +7 -7
  87. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Python/callback.tmpl +27 -0
  88. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Python/class.tmpl +5 -4
  89. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Python/field.tmpl +1 -0
  90. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Python/function.tmpl +8 -14
  91. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Python/interface.tmpl +16 -0
  92. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Python/property.tmpl +2 -3
  93. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Python/signal.tmpl +6 -7
  94. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Python/vfunc.tmpl +7 -13
  95. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/base.tmpl +10 -19
  96. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/class.tmpl +24 -3
  97. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/namespace.tmpl +4 -7
  98. data/vendor/local/lib/gobject-introspection/giscanner/docwriter.py +375 -61
  99. data/vendor/local/lib/gobject-introspection/giscanner/docwriter.pyc +0 -0
  100. data/vendor/local/lib/gobject-introspection/giscanner/docwriter.pyo +0 -0
  101. data/vendor/local/lib/gobject-introspection/giscanner/dumper.py +43 -75
  102. data/vendor/local/lib/gobject-introspection/giscanner/dumper.pyc +0 -0
  103. data/vendor/local/lib/gobject-introspection/giscanner/dumper.pyo +0 -0
  104. data/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.py +1 -20
  105. data/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyc +0 -0
  106. data/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyo +0 -0
  107. data/vendor/local/lib/gobject-introspection/giscanner/girparser.py +33 -15
  108. data/vendor/local/lib/gobject-introspection/giscanner/girparser.pyc +0 -0
  109. data/vendor/local/lib/gobject-introspection/giscanner/girparser.pyo +0 -0
  110. data/vendor/local/lib/gobject-introspection/giscanner/girwriter.py +51 -22
  111. data/vendor/local/lib/gobject-introspection/giscanner/girwriter.pyc +0 -0
  112. data/vendor/local/lib/gobject-introspection/giscanner/girwriter.pyo +0 -0
  113. data/vendor/local/lib/gobject-introspection/giscanner/introspectablepass.pyc +0 -0
  114. data/vendor/local/lib/gobject-introspection/giscanner/introspectablepass.pyo +0 -0
  115. data/vendor/local/lib/gobject-introspection/giscanner/libtoolimporter.pyc +0 -0
  116. data/vendor/local/lib/gobject-introspection/giscanner/libtoolimporter.pyo +0 -0
  117. data/vendor/local/lib/gobject-introspection/giscanner/maintransformer.py +285 -254
  118. data/vendor/local/lib/gobject-introspection/giscanner/maintransformer.pyc +0 -0
  119. data/vendor/local/lib/gobject-introspection/giscanner/maintransformer.pyo +0 -0
  120. data/vendor/local/lib/gobject-introspection/giscanner/message.py +41 -25
  121. data/vendor/local/lib/gobject-introspection/giscanner/message.pyc +0 -0
  122. data/vendor/local/lib/gobject-introspection/giscanner/message.pyo +0 -0
  123. data/vendor/local/lib/gobject-introspection/giscanner/scannermain.py +67 -15
  124. data/vendor/local/lib/gobject-introspection/giscanner/scannermain.pyc +0 -0
  125. data/vendor/local/lib/gobject-introspection/giscanner/scannermain.pyo +0 -0
  126. data/vendor/local/lib/gobject-introspection/giscanner/sectionparser.pyc +0 -0
  127. data/vendor/local/lib/gobject-introspection/giscanner/sectionparser.pyo +0 -0
  128. data/vendor/local/lib/gobject-introspection/giscanner/shlibs.py +10 -6
  129. data/vendor/local/lib/gobject-introspection/giscanner/shlibs.pyc +0 -0
  130. data/vendor/local/lib/gobject-introspection/giscanner/shlibs.pyo +0 -0
  131. data/vendor/local/lib/gobject-introspection/giscanner/sourcescanner.py +14 -8
  132. data/vendor/local/lib/gobject-introspection/giscanner/sourcescanner.pyc +0 -0
  133. data/vendor/local/lib/gobject-introspection/giscanner/sourcescanner.pyo +0 -0
  134. data/vendor/local/lib/gobject-introspection/giscanner/testcodegen.py +16 -2
  135. data/vendor/local/lib/gobject-introspection/giscanner/testcodegen.pyc +0 -0
  136. data/vendor/local/lib/gobject-introspection/giscanner/testcodegen.pyo +0 -0
  137. data/vendor/local/lib/gobject-introspection/giscanner/transformer.py +150 -169
  138. data/vendor/local/lib/gobject-introspection/giscanner/transformer.pyc +0 -0
  139. data/vendor/local/lib/gobject-introspection/giscanner/transformer.pyo +0 -0
  140. data/vendor/local/lib/gobject-introspection/giscanner/utils.py +64 -3
  141. data/vendor/local/lib/gobject-introspection/giscanner/utils.pyc +0 -0
  142. data/vendor/local/lib/gobject-introspection/giscanner/utils.pyo +0 -0
  143. data/vendor/local/lib/gobject-introspection/giscanner/xmlwriter.py +5 -44
  144. data/vendor/local/lib/gobject-introspection/giscanner/xmlwriter.pyc +0 -0
  145. data/vendor/local/lib/gobject-introspection/giscanner/xmlwriter.pyo +0 -0
  146. data/vendor/local/lib/libgirepository-1.0.a +0 -0
  147. data/vendor/local/lib/libgirepository-1.0.dll.a +0 -0
  148. data/vendor/local/lib/libgirepository-1.0.la +1 -1
  149. data/vendor/local/lib/pkgconfig/gobject-introspection-1.0.pc +4 -4
  150. data/vendor/local/lib/pkgconfig/gobject-introspection-no-export-1.0.pc +5 -5
  151. data/vendor/local/share/gir-1.0/GIRepository-2.0.gir +352 -143
  152. data/vendor/local/share/gir-1.0/GLib-2.0.gir +6402 -3872
  153. data/vendor/local/share/gir-1.0/GModule-2.0.gir +42 -24
  154. data/vendor/local/share/gir-1.0/GObject-2.0.gir +1543 -887
  155. data/vendor/local/share/gir-1.0/Gio-2.0.gir +10859 -3705
  156. data/vendor/local/share/gobject-introspection-1.0/tests/annotation.c +10 -14
  157. data/vendor/local/share/gobject-introspection-1.0/tests/annotation.h +112 -9
  158. data/vendor/local/share/gobject-introspection-1.0/tests/drawable.c +2 -0
  159. data/vendor/local/share/gobject-introspection-1.0/tests/drawable.h +11 -0
  160. data/vendor/local/share/gobject-introspection-1.0/tests/everything.c +106 -0
  161. data/vendor/local/share/gobject-introspection-1.0/tests/everything.h +107 -0
  162. data/vendor/local/share/gobject-introspection-1.0/tests/foo.c +3 -3
  163. data/vendor/local/share/gobject-introspection-1.0/tests/foo.h +145 -0
  164. data/vendor/local/share/gobject-introspection-1.0/tests/gimarshallingtests.c +166 -10
  165. data/vendor/local/share/gobject-introspection-1.0/tests/gimarshallingtests.h +790 -0
  166. data/vendor/local/share/gobject-introspection-1.0/tests/gitestmacros.h +10 -0
  167. data/vendor/local/share/gobject-introspection-1.0/tests/regress.c +79 -28
  168. data/vendor/local/share/gobject-introspection-1.0/tests/regress.h +462 -0
  169. data/vendor/local/share/gobject-introspection-1.0/tests/utility.c +2 -0
  170. data/vendor/local/share/gobject-introspection-1.0/tests/utility.h +7 -0
  171. data/vendor/local/share/gobject-introspection-1.0/tests/warnlib.c +14 -0
  172. data/vendor/local/share/gobject-introspection-1.0/tests/warnlib.h +10 -0
  173. data/vendor/local/share/man/man1/g-ir-compiler.1 +1 -10
  174. metadata +38 -23
  175. data/lib/1.9/gobject_introspection.so +0 -0
  176. data/lib/2.1/gobject_introspection.so +0 -0
@@ -27,6 +27,7 @@ import tempfile
27
27
 
28
28
  from .gdumpparser import IntrospectionBinary
29
29
  from . import utils
30
+ from .ccompiler import CCompiler
30
31
 
31
32
  # bugzilla.gnome.org/558436
32
33
  # Compile a binary program which is then linked to a library
@@ -82,7 +83,7 @@ class DumpCompiler(object):
82
83
  self._get_type_functions = get_type_functions
83
84
  self._error_quark_functions = error_quark_functions
84
85
 
85
- self._compiler_cmd = os.environ.get('CC', 'gcc')
86
+ self._compiler_cmd = os.environ.get('CC', 'cc')
86
87
  self._linker_cmd = os.environ.get('CC', self._compiler_cmd)
87
88
  self._pkgconfig_cmd = os.environ.get('PKG_CONFIG', 'pkg-config')
88
89
  self._pkgconfig_msvc_flags = ''
@@ -103,6 +104,7 @@ class DumpCompiler(object):
103
104
  # We have to use the current directory to work around Unix
104
105
  # sysadmins who mount /tmp noexec
105
106
  tmpdir = tempfile.mkdtemp('', 'tmp-introspect', dir=os.getcwd())
107
+ os.mkdir(os.path.join(tmpdir, '.libs'))
106
108
 
107
109
  tpl_args = {}
108
110
  if self._uninst_srcdir is not None:
@@ -159,7 +161,7 @@ class DumpCompiler(object):
159
161
  o_path = self._generate_tempfile(tmpdir, '.o')
160
162
 
161
163
  if os.name == 'nt':
162
- ext = 'exe'
164
+ ext = '.exe'
163
165
  else:
164
166
  ext = ''
165
167
 
@@ -214,7 +216,10 @@ class DumpCompiler(object):
214
216
  else:
215
217
  args.append("-Wno-deprecated-declarations")
216
218
  pkgconfig_flags = self._run_pkgconfig('--cflags')
217
- args.extend(pkgconfig_flags)
219
+ args.extend([utils.cflag_real_include_path(f) for f in pkgconfig_flags])
220
+ cppflags = os.environ.get('CPPFLAGS', '')
221
+ for cppflag in cppflags.split():
222
+ args.append(cppflag)
218
223
  cflags = os.environ.get('CFLAGS', '')
219
224
  for cflag in cflags.split():
220
225
  args.append(cflag)
@@ -259,10 +264,13 @@ class DumpCompiler(object):
259
264
  args.extend(['-o', output])
260
265
  if libtool:
261
266
  if os.name == 'nt':
262
- args.append('-export-all-symbols')
267
+ args.append('-Wl,--export-all-symbols')
263
268
  else:
264
269
  args.append('-export-dynamic')
265
270
 
271
+ cppflags = os.environ.get('CPPFLAGS', '')
272
+ for cppflag in cppflags.split():
273
+ args.append(cppflag)
266
274
  cflags = os.environ.get('CFLAGS', '')
267
275
  for cflag in cflags.split():
268
276
  args.append(cflag)
@@ -280,88 +288,48 @@ class DumpCompiler(object):
280
288
  "Could not find object file: %s" % (source, ))
281
289
  args.extend(list(sources))
282
290
 
291
+ cc = CCompiler()
292
+
283
293
  if not self._options.external_library:
284
- self._add_link_internal_args(args, libtool)
294
+ cc.get_internal_link_flags(args,
295
+ libtool,
296
+ self._options.libraries,
297
+ self._options.library_paths,
298
+ self._pkgconfig_msvc_flags,
299
+ self._options.namespace_name,
300
+ self._options.namespace_version)
301
+ args.extend(self._run_pkgconfig('--libs'))
302
+
285
303
  else:
286
- self._add_link_external_args(args)
304
+ args.extend(self._run_pkgconfig('--libs'))
305
+ cc.get_external_link_flags(args,
306
+ self._options.libraries,
307
+ self._pkgconfig_msvc_flags)
287
308
 
288
309
  if not self._options.quiet:
289
310
  print "g-ir-scanner: link: %s" % (
290
311
  subprocess.list2cmdline(args), )
291
312
  sys.stdout.flush()
313
+ msys = os.environ.get('MSYSTEM', None)
314
+ if msys:
315
+ shell = os.environ.get('SHELL', 'sh.exe')
316
+ # Create a temporary script file that
317
+ # runs the command we want
318
+ tf, tf_name = tempfile.mkstemp()
319
+ f = os.fdopen(tf, 'wb')
320
+ shellcontents = ' '.join([x.replace('\\', '/') for x in args])
321
+ fcontents = '#!/bin/sh\nunset PWD\n{}\n'.format(shellcontents)
322
+ f.write(fcontents)
323
+ f.close()
324
+ shell = utils.which(shell)
325
+ args = [shell, tf_name.replace('\\', '/')]
292
326
  try:
293
327
  subprocess.check_call(args)
294
328
  except subprocess.CalledProcessError as e:
295
329
  raise LinkerError(e)
296
-
297
- def _add_link_internal_args(self, args, libtool):
298
- # An "internal" link is where the library to be introspected
299
- # is being built in the current directory.
300
-
301
- # Search the current directory first
302
- # (This flag is not supported nor needed for Visual C++)
303
- if self._pkgconfig_msvc_flags == '':
304
- args.append('-L.')
305
-
306
- # https://bugzilla.gnome.org/show_bug.cgi?id=625195
307
- if not libtool:
308
- # We don't have -Wl,-rpath for Visual C++, and that's
309
- # going to cause a problem. Instead, link to internal
310
- # libraries by deducing the .lib file name using
311
- # the namespace name and version
312
- if self._pkgconfig_msvc_flags:
313
- if self._options.namespace_version:
314
- args.append(str.lower(self._options.namespace_name) +
315
- '-' +
316
- self._options.namespace_version + '.lib')
317
- else:
318
- args.append(str.lower(self._options.namespace_name) + '.lib')
319
- else:
320
- args.append('-Wl,-rpath=.')
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
-
327
- for library in self._options.libraries:
328
- # Visual C++: We have the needed .lib files now, and we need to link
329
- # to .lib files, not the .dll as the --library option specifies the
330
- # .dll(s) the .gir file refers to
331
- if self._pkgconfig_msvc_flags == '':
332
- if library.endswith(".la"): # explicitly specified libtool library
333
- args.append(library)
334
- else:
335
- args.append('-l' + library)
336
-
337
- for library_path in self._options.library_paths:
338
- # Not used/needed on Visual C++, and -Wl,-rpath options
339
- # will cause grief
340
- if self._pkgconfig_msvc_flags == '':
341
- args.append('-L' + library_path)
342
- if os.path.isabs(library_path):
343
- if libtool:
344
- args.append('-rpath')
345
- args.append(library_path)
346
- else:
347
- args.append('-Wl,-rpath=' + library_path)
348
-
349
- args.extend(self._run_pkgconfig('--libs'))
350
-
351
- def _add_link_external_args(self, args):
352
- # An "external" link is where the library to be introspected
353
- # is installed on the system; this case is used for the scanning
354
- # of GLib in gobject-introspection itself.
355
-
356
- args.extend(self._run_pkgconfig('--libs'))
357
- for library in self._options.libraries:
358
- # The --library option on Windows pass in the .dll file(s) the
359
- # .gir files refer to, so don't link to them on Visual C++
360
- if self._pkgconfig_msvc_flags == '':
361
- if library.endswith(".la"): # explicitly specified libtool library
362
- args.append(library)
363
- else:
364
- args.append('-l' + library)
330
+ finally:
331
+ if msys:
332
+ os.remove(tf_name)
365
333
 
366
334
 
367
335
  def compile_introspection_binary(options, get_type_functions,
@@ -297,7 +297,7 @@ blob containing data gleaned from GObject's primitive introspection."""
297
297
  (ns, name) = self._transformer.split_csymbol(get_type)
298
298
  assert ns is self._namespace
299
299
  if name in ('get_type', '_get_gtype'):
300
- message.fatal("""The GObject name %r isn't compatibile
300
+ message.fatal("""The GObject name %r isn't compatible
301
301
  with the configured identifier prefixes:
302
302
  %r
303
303
  The class would have no name. Most likely you want to specify a
@@ -326,17 +326,6 @@ different --identifier-prefix.""" % (xmlnode.attrib['name'], self._namespace.ide
326
326
  self._introspect_signals(node, xmlnode)
327
327
  self._introspect_implemented_interfaces(node, xmlnode)
328
328
  self._add_record_fields(node)
329
-
330
- if node.name == 'InitiallyUnowned':
331
- # http://bugzilla.gnome.org/show_bug.cgi?id=569408
332
- # GInitiallyUnowned is actually a typedef for GObject, but
333
- # that's not reflected in the GIR, where it appears as a
334
- # subclass (as it appears in the GType hierarchy). So
335
- # what we do here is copy all of the GObject fields into
336
- # GInitiallyUnowned so that struct offset computation
337
- # works correctly.
338
- node.fields = self._namespace.get('Object').fields
339
-
340
329
  self._namespace.append(node, replace=True)
341
330
 
342
331
  def _introspect_interface(self, xmlnode):
@@ -523,14 +512,6 @@ different --identifier-prefix.""" % (xmlnode.attrib['name'], self._namespace.ide
523
512
  else:
524
513
  return False
525
514
 
526
- def _strip_class_suffix(self, name):
527
- if (name.endswith('Class') or name.endswith('Iface')):
528
- return name[:-5]
529
- elif name.endswith('Interface'):
530
- return name[:-9]
531
- else:
532
- return None
533
-
534
515
  def _find_class_record(self, cls):
535
516
  pair_record = None
536
517
  if isinstance(cls, ast.Class):
@@ -69,9 +69,6 @@ class GIRParser(object):
69
69
  def get_namespace(self):
70
70
  return self._namespace
71
71
 
72
- def get_c_prefix(self):
73
- return self._c_prefix
74
-
75
72
  # Private
76
73
 
77
74
  def _find_first_child(self, node, name_or_names):
@@ -180,12 +177,24 @@ class GIRParser(object):
180
177
  version = node.attrib.get('version')
181
178
  if version:
182
179
  obj.version = version
183
- deprecated = node.attrib.get('deprecated')
180
+ version_doc = node.find(_corens('doc-version'))
181
+ if version_doc is not None:
182
+ if version_doc.text:
183
+ obj.version_doc = version_doc.text
184
+ deprecated = node.attrib.get('deprecated-version')
184
185
  if deprecated:
185
186
  obj.deprecated = deprecated
186
- deprecated_version = node.attrib.get('deprecated-version')
187
- if deprecated_version:
188
- obj.deprecated_version = deprecated_version
187
+ deprecated_doc = node.find(_corens('doc-deprecated'))
188
+ if deprecated_doc is not None:
189
+ if deprecated_doc.text:
190
+ obj.deprecated_doc = deprecated_doc.text
191
+ stability = node.attrib.get('stability')
192
+ if stability:
193
+ obj.stability = stability
194
+ stability_doc = node.find(_corens('doc-stability'))
195
+ if stability_doc is not None:
196
+ if stability_doc.text:
197
+ obj.stability_doc = stability_doc.text
189
198
 
190
199
  def _parse_object_interface(self, node):
191
200
  parent = node.attrib.get('parent')
@@ -271,6 +280,8 @@ class GIRParser(object):
271
280
  typeval,
272
281
  node.attrib.get('direction') or ast.PARAM_DIRECTION_IN,
273
282
  node.attrib.get('transfer-ownership'),
283
+ node.attrib.get('nullable') == '1',
284
+ node.attrib.get('optional') == '1',
274
285
  node.attrib.get('allow-none') == '1',
275
286
  node.attrib.get('scope'),
276
287
  node.attrib.get('caller-allocates') == '1')
@@ -283,7 +294,8 @@ class GIRParser(object):
283
294
  if not returnnode:
284
295
  raise ValueError('node %r has no return-value' % (name, ))
285
296
  transfer = returnnode.attrib.get('transfer-ownership')
286
- retval = ast.Return(self._parse_type(returnnode), transfer)
297
+ nullable = returnnode.attrib.get('nullable') == '1'
298
+ retval = ast.Return(self._parse_type(returnnode), nullable, transfer)
287
299
  self._parse_generic_attribs(returnnode, retval)
288
300
  parameters = []
289
301
 
@@ -322,7 +334,7 @@ class GIRParser(object):
322
334
  for i, paramnode in enumerate(self._find_children(parameters_node,
323
335
  _corens('parameter'))):
324
336
  param = parameters[i]
325
- self._parse_type_second_pass(func, paramnode, param.type)
337
+ self._parse_type_array_length(parameters, paramnode, param.type)
326
338
  closure = paramnode.attrib.get('closure')
327
339
  if closure:
328
340
  idx = int(closure)
@@ -334,7 +346,7 @@ class GIRParser(object):
334
346
  assert idx < len(parameters), "%d >= %d" % (idx, len(parameters))
335
347
  param.destroy_name = parameters[idx].argname
336
348
 
337
- self._parse_type_second_pass(func, returnnode, retval.type)
349
+ self._parse_type_array_length(parameters, returnnode, retval.type)
338
350
 
339
351
  self._parse_generic_attribs(node, func)
340
352
 
@@ -366,6 +378,9 @@ class GIRParser(object):
366
378
  func = self._parse_function_common(method, ast.Function, compound)
367
379
  func.is_method = True
368
380
  compound.methods.append(func)
381
+ for i, fieldnode in enumerate(self._find_children(node, _corens('field'))):
382
+ field = compound.fields[i]
383
+ self._parse_type_array_length(compound.fields, fieldnode, field.type)
369
384
  for func in self._find_children(node, _corens('function')):
370
385
  compound.static_methods.append(
371
386
  self._parse_function_common(func, ast.Function, compound))
@@ -447,8 +462,8 @@ class GIRParser(object):
447
462
  return self._parse_type_simple(typenode)
448
463
  assert False, "Failed to parse toplevel type"
449
464
 
450
- def _parse_type_second_pass(self, parent, node, typeval):
451
- """A hack necessary to handle the integer parameter indexes on
465
+ def _parse_type_array_length(self, siblings, node, typeval):
466
+ """A hack necessary to handle the integer parameter/field indexes on
452
467
  array types."""
453
468
  typenode = node.find(_corens('array'))
454
469
  if typenode is None:
@@ -456,9 +471,11 @@ class GIRParser(object):
456
471
  lenidx = typenode.attrib.get('length')
457
472
  if lenidx is not None:
458
473
  idx = int(lenidx)
459
- assert idx < len(parent.parameters), "%r %d >= %d" % (parent, idx,
460
- len(parent.parameters))
461
- typeval.length_param_name = parent.parameters[idx].argname
474
+ assert idx < len(siblings), "%r %d >= %d" % (parent, idx, len(siblings))
475
+ if isinstance(siblings[idx], ast.Field):
476
+ typeval.length_param_name = siblings[idx].name
477
+ else:
478
+ typeval.length_param_name = siblings[idx].argname
462
479
 
463
480
  def _parse_boxed(self, node):
464
481
  obj = ast.Boxed(node.attrib[_glibns('name')],
@@ -571,5 +588,6 @@ class GIRParser(object):
571
588
  members.append(member)
572
589
  for func_node in self._find_children(node, _corens('function')):
573
590
  func = self._parse_function_common(func_node, ast.Function)
591
+ func.parent = obj
574
592
  obj.static_methods.append(func)
575
593
  self._namespace.append(obj)
@@ -123,20 +123,39 @@ class GIRWriter(XMLWriter):
123
123
  attrs.append(('version', node.version))
124
124
 
125
125
  def _write_generic(self, node):
126
- for key, value in node.attributes:
126
+ for key, value in node.attributes.items():
127
127
  self.write_tag('attribute', [('name', key), ('value', value)])
128
+
128
129
  if hasattr(node, 'doc') and node.doc:
129
130
  self.write_tag('doc', [('xml:space', 'preserve')],
130
131
  node.doc)
131
132
 
133
+ if hasattr(node, 'version_doc') and node.version_doc:
134
+ self.write_tag('doc-version', [('xml:space', 'preserve')],
135
+ node.version_doc)
136
+
137
+ if hasattr(node, 'deprecated_doc') and node.deprecated_doc:
138
+ self.write_tag('doc-deprecated', [('xml:space', 'preserve')],
139
+ node.deprecated_doc)
140
+
141
+ if hasattr(node, 'stability_doc') and node.stability_doc:
142
+ self.write_tag('doc-stability', [('xml:space', 'preserve')],
143
+ node.stability_doc)
144
+
132
145
  def _append_node_generic(self, node, attrs):
133
146
  if node.skip or not node.introspectable:
134
147
  attrs.append(('introspectable', '0'))
148
+
149
+ if node.deprecated or node.deprecated_doc:
150
+ # The deprecated attribute used to contain node.deprecated_doc as an attribute. As
151
+ # an xml attribute cannot preserve whitespace, deprecated_doc has been moved into
152
+ # it's own tag, written in _write_generic() above. We continue to write the deprecated
153
+ # attribute for backwards compatibility
154
+ attrs.append(('deprecated', '1'))
155
+
135
156
  if node.deprecated:
136
- attrs.append(('deprecated', node.deprecated))
137
- if node.deprecated_version:
138
- attrs.append(('deprecated-version',
139
- node.deprecated_version))
157
+ attrs.append(('deprecated-version', node.deprecated))
158
+
140
159
  if node.stability:
141
160
  attrs.append(('stability', node.stability))
142
161
 
@@ -196,9 +215,11 @@ class GIRWriter(XMLWriter):
196
215
  attrs.append(('transfer-ownership', return_.transfer))
197
216
  if return_.skip:
198
217
  attrs.append(('skip', '1'))
218
+ if return_.nullable:
219
+ attrs.append(('nullable', '1'))
199
220
  with self.tagcontext('return-value', attrs):
200
221
  self._write_generic(return_)
201
- self._write_type(return_.type, function=parent)
222
+ self._write_type(return_.type, parent=parent)
202
223
 
203
224
  def _write_parameters(self, callable):
204
225
  if not callable.parameters and callable.instance_parameter is None:
@@ -220,8 +241,14 @@ class GIRWriter(XMLWriter):
220
241
  if parameter.transfer:
221
242
  attrs.append(('transfer-ownership',
222
243
  parameter.transfer))
223
- if parameter.allow_none:
224
- attrs.append(('allow-none', '1'))
244
+ if parameter.nullable:
245
+ attrs.append(('nullable', '1'))
246
+ if parameter.direction != ast.PARAM_DIRECTION_OUT:
247
+ attrs.append(('allow-none', '1'))
248
+ if parameter.optional:
249
+ attrs.append(('optional', '1'))
250
+ if parameter.direction == ast.PARAM_DIRECTION_OUT:
251
+ attrs.append(('allow-none', '1'))
225
252
  if parameter.scope:
226
253
  attrs.append(('scope', parameter.scope))
227
254
  if parameter.closure_name is not None:
@@ -234,7 +261,7 @@ class GIRWriter(XMLWriter):
234
261
  attrs.append(('skip', '1'))
235
262
  with self.tagcontext(nodename, attrs):
236
263
  self._write_generic(parameter)
237
- self._write_type(parameter.type, function=parent)
264
+ self._write_type(parameter.type, parent=parent)
238
265
 
239
266
  def _type_to_name(self, typeval):
240
267
  if not typeval.resolved:
@@ -267,7 +294,7 @@ class GIRWriter(XMLWriter):
267
294
 
268
295
  self.write_tag('type', attrs)
269
296
 
270
- def _write_type(self, ntype, relation=None, function=None):
297
+ def _write_type(self, ntype, relation=None, parent=None):
271
298
  assert isinstance(ntype, ast.Type), ntype
272
299
  attrs = []
273
300
  if ntype.complete_ctype:
@@ -275,8 +302,7 @@ class GIRWriter(XMLWriter):
275
302
  elif ntype.ctype:
276
303
  attrs.append(('c:type', ntype.ctype))
277
304
  if isinstance(ntype, ast.Varargs):
278
- with self.tagcontext('varargs', []):
279
- pass
305
+ self.write_tag('varargs', [])
280
306
  elif isinstance(ntype, ast.Array):
281
307
  if ntype.array_type != ast.Array.C:
282
308
  attrs.insert(0, ('name', ntype.array_type))
@@ -291,8 +317,12 @@ class GIRWriter(XMLWriter):
291
317
  if ntype.size is not None:
292
318
  attrs.append(('fixed-size', '%d' % (ntype.size, )))
293
319
  if ntype.length_param_name is not None:
294
- assert function
295
- length = function.get_parameter_index(ntype.length_param_name)
320
+ if isinstance(parent, ast.Callable):
321
+ length = parent.get_parameter_index(ntype.length_param_name)
322
+ elif isinstance(parent, ast.Compound):
323
+ length = parent.get_field_index(ntype.length_param_name)
324
+ else:
325
+ assert False, "parent not a callable or compound: %r" % parent
296
326
  attrs.insert(0, ('length', '%d' % (length, )))
297
327
 
298
328
  with self.tagcontext('array', attrs):
@@ -418,9 +448,8 @@ class GIRWriter(XMLWriter):
418
448
  if isinstance(node, ast.Class):
419
449
  for method in sorted(node.constructors):
420
450
  self._write_constructor(method)
421
- if isinstance(node, (ast.Class, ast.Interface)):
422
- for method in sorted(node.static_methods):
423
- self._write_static_method(method)
451
+ for method in sorted(node.static_methods):
452
+ self._write_static_method(method)
424
453
  for vfunc in sorted(node.virtual_methods):
425
454
  self._write_vfunc(vfunc)
426
455
  for method in sorted(node.methods):
@@ -428,7 +457,7 @@ class GIRWriter(XMLWriter):
428
457
  for prop in sorted(node.properties):
429
458
  self._write_property(prop)
430
459
  for field in node.fields:
431
- self._write_field(field)
460
+ self._write_field(field, node)
432
461
  for signal in sorted(node.signals):
433
462
  self._write_signal(signal)
434
463
 
@@ -501,7 +530,7 @@ class GIRWriter(XMLWriter):
501
530
  self._write_generic(record)
502
531
  if record.fields:
503
532
  for field in record.fields:
504
- self._write_field(field, is_gtype_struct)
533
+ self._write_field(field, record, is_gtype_struct)
505
534
  for method in sorted(record.constructors):
506
535
  self._write_constructor(method)
507
536
  for method in sorted(record.methods):
@@ -524,7 +553,7 @@ class GIRWriter(XMLWriter):
524
553
  self._write_generic(union)
525
554
  if union.fields:
526
555
  for field in union.fields:
527
- self._write_field(field)
556
+ self._write_field(field, union)
528
557
  for method in sorted(union.constructors):
529
558
  self._write_constructor(method)
530
559
  for method in sorted(union.methods):
@@ -532,7 +561,7 @@ class GIRWriter(XMLWriter):
532
561
  for method in sorted(union.static_methods):
533
562
  self._write_static_method(method)
534
563
 
535
- def _write_field(self, field, is_gtype_struct=False):
564
+ def _write_field(self, field, parent, is_gtype_struct=False):
536
565
  if field.anonymous_node:
537
566
  if isinstance(field.anonymous_node, ast.Callback):
538
567
  attrs = [('name', field.name)]
@@ -560,7 +589,7 @@ class GIRWriter(XMLWriter):
560
589
  attrs.append(('private', '1'))
561
590
  with self.tagcontext('field', attrs):
562
591
  self._write_generic(field)
563
- self._write_type(field.type)
592
+ self._write_type(field.type, parent=parent)
564
593
 
565
594
  def _write_signal(self, signal):
566
595
  attrs = [('name', signal.name)]