gobject-introspection 3.1.8-x86-mingw32 → 3.1.9-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (95) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +2 -2
  3. data/ext/gobject-introspection/rb-gi-argument.c +49 -9
  4. data/ext/gobject-introspection/rb-gi-loader.c +74 -1
  5. data/lib/2.2/gobject_introspection.so +0 -0
  6. data/lib/2.3/gobject_introspection.so +0 -0
  7. data/lib/2.4/gobject_introspection.so +0 -0
  8. data/test/run-test.rb +1 -1
  9. data/vendor/local/bin/g-ir-compiler.exe +0 -0
  10. data/vendor/local/bin/g-ir-generate.exe +0 -0
  11. data/vendor/local/bin/g-ir-inspect.exe +0 -0
  12. data/vendor/local/bin/libgirepository-1.0-1.dll +0 -0
  13. data/vendor/local/lib/girepository-1.0/GLib-2.0.typelib +0 -0
  14. data/vendor/local/lib/girepository-1.0/GModule-2.0.typelib +0 -0
  15. data/vendor/local/lib/girepository-1.0/GObject-2.0.typelib +0 -0
  16. data/vendor/local/lib/girepository-1.0/Gio-2.0.typelib +0 -0
  17. data/vendor/local/lib/girepository-1.0/cairo-1.0.typelib +0 -0
  18. data/vendor/local/lib/gobject-introspection/giscanner/__init__.pyc +0 -0
  19. data/vendor/local/lib/gobject-introspection/giscanner/__init__.pyo +0 -0
  20. data/vendor/local/lib/gobject-introspection/giscanner/annotationmain.pyc +0 -0
  21. data/vendor/local/lib/gobject-introspection/giscanner/annotationmain.pyo +0 -0
  22. data/vendor/local/lib/gobject-introspection/giscanner/annotationparser.pyc +0 -0
  23. data/vendor/local/lib/gobject-introspection/giscanner/annotationparser.pyo +0 -0
  24. data/vendor/local/lib/gobject-introspection/giscanner/ast.pyc +0 -0
  25. data/vendor/local/lib/gobject-introspection/giscanner/ast.pyo +0 -0
  26. data/vendor/local/lib/gobject-introspection/giscanner/cachestore.py +8 -14
  27. data/vendor/local/lib/gobject-introspection/giscanner/cachestore.pyc +0 -0
  28. data/vendor/local/lib/gobject-introspection/giscanner/cachestore.pyo +0 -0
  29. data/vendor/local/lib/gobject-introspection/giscanner/ccompiler.py +48 -51
  30. data/vendor/local/lib/gobject-introspection/giscanner/ccompiler.pyc +0 -0
  31. data/vendor/local/lib/gobject-introspection/giscanner/ccompiler.pyo +0 -0
  32. data/vendor/local/lib/gobject-introspection/giscanner/codegen.pyc +0 -0
  33. data/vendor/local/lib/gobject-introspection/giscanner/codegen.pyo +0 -0
  34. data/vendor/local/lib/gobject-introspection/giscanner/collections/__init__.pyc +0 -0
  35. data/vendor/local/lib/gobject-introspection/giscanner/collections/__init__.pyo +0 -0
  36. data/vendor/local/lib/gobject-introspection/giscanner/collections/counter.pyc +0 -0
  37. data/vendor/local/lib/gobject-introspection/giscanner/collections/counter.pyo +0 -0
  38. data/vendor/local/lib/gobject-introspection/giscanner/collections/ordereddict.pyc +0 -0
  39. data/vendor/local/lib/gobject-introspection/giscanner/collections/ordereddict.pyo +0 -0
  40. data/vendor/local/lib/gobject-introspection/giscanner/docmain.pyc +0 -0
  41. data/vendor/local/lib/gobject-introspection/giscanner/docmain.pyo +0 -0
  42. data/vendor/local/lib/gobject-introspection/giscanner/docwriter.pyc +0 -0
  43. data/vendor/local/lib/gobject-introspection/giscanner/docwriter.pyo +0 -0
  44. data/vendor/local/lib/gobject-introspection/giscanner/dumper.py +39 -66
  45. data/vendor/local/lib/gobject-introspection/giscanner/dumper.pyc +0 -0
  46. data/vendor/local/lib/gobject-introspection/giscanner/dumper.pyo +0 -0
  47. data/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyc +0 -0
  48. data/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyo +0 -0
  49. data/vendor/local/lib/gobject-introspection/giscanner/girparser.pyc +0 -0
  50. data/vendor/local/lib/gobject-introspection/giscanner/girparser.pyo +0 -0
  51. data/vendor/local/lib/gobject-introspection/giscanner/girwriter.pyc +0 -0
  52. data/vendor/local/lib/gobject-introspection/giscanner/girwriter.pyo +0 -0
  53. data/vendor/local/lib/gobject-introspection/giscanner/introspectablepass.pyc +0 -0
  54. data/vendor/local/lib/gobject-introspection/giscanner/introspectablepass.pyo +0 -0
  55. data/vendor/local/lib/gobject-introspection/giscanner/libtoolimporter.pyc +0 -0
  56. data/vendor/local/lib/gobject-introspection/giscanner/libtoolimporter.pyo +0 -0
  57. data/vendor/local/lib/gobject-introspection/giscanner/maintransformer.pyc +0 -0
  58. data/vendor/local/lib/gobject-introspection/giscanner/maintransformer.pyo +0 -0
  59. data/vendor/local/lib/gobject-introspection/giscanner/message.pyc +0 -0
  60. data/vendor/local/lib/gobject-introspection/giscanner/message.pyo +0 -0
  61. data/vendor/local/lib/gobject-introspection/giscanner/msvccompiler.pyc +0 -0
  62. data/vendor/local/lib/gobject-introspection/giscanner/msvccompiler.pyo +0 -0
  63. data/vendor/local/lib/gobject-introspection/giscanner/scannermain.pyc +0 -0
  64. data/vendor/local/lib/gobject-introspection/giscanner/scannermain.pyo +0 -0
  65. data/vendor/local/lib/gobject-introspection/giscanner/sectionparser.pyc +0 -0
  66. data/vendor/local/lib/gobject-introspection/giscanner/sectionparser.pyo +0 -0
  67. data/vendor/local/lib/gobject-introspection/giscanner/shlibs.pyc +0 -0
  68. data/vendor/local/lib/gobject-introspection/giscanner/shlibs.pyo +0 -0
  69. data/vendor/local/lib/gobject-introspection/giscanner/sourcescanner.py +3 -1
  70. data/vendor/local/lib/gobject-introspection/giscanner/sourcescanner.pyc +0 -0
  71. data/vendor/local/lib/gobject-introspection/giscanner/sourcescanner.pyo +0 -0
  72. data/vendor/local/lib/gobject-introspection/giscanner/testcodegen.pyc +0 -0
  73. data/vendor/local/lib/gobject-introspection/giscanner/testcodegen.pyo +0 -0
  74. data/vendor/local/lib/gobject-introspection/giscanner/transformer.pyc +0 -0
  75. data/vendor/local/lib/gobject-introspection/giscanner/transformer.pyo +0 -0
  76. data/vendor/local/lib/gobject-introspection/giscanner/utils.py +3 -3
  77. data/vendor/local/lib/gobject-introspection/giscanner/utils.pyc +0 -0
  78. data/vendor/local/lib/gobject-introspection/giscanner/utils.pyo +0 -0
  79. data/vendor/local/lib/gobject-introspection/giscanner/xmlwriter.pyc +0 -0
  80. data/vendor/local/lib/gobject-introspection/giscanner/xmlwriter.pyo +0 -0
  81. data/vendor/local/lib/libgirepository-1.0.a +0 -0
  82. data/vendor/local/lib/libgirepository-1.0.dll.a +0 -0
  83. data/vendor/local/lib/pkgconfig/gobject-introspection-1.0.pc +1 -1
  84. data/vendor/local/lib/pkgconfig/gobject-introspection-no-export-1.0.pc +1 -1
  85. data/vendor/local/share/gir-1.0/GLib-2.0.gir +579 -528
  86. data/vendor/local/share/gir-1.0/GModule-2.0.gir +0 -25
  87. data/vendor/local/share/gir-1.0/GObject-2.0.gir +160 -3
  88. data/vendor/local/share/gir-1.0/Gio-2.0.gir +198 -83
  89. data/vendor/local/share/gir-1.0/cairo-1.0.gir +622 -21
  90. data/vendor/local/share/gir-1.0/gir-1.2.rnc +479 -0
  91. data/vendor/local/share/gobject-introspection-1.0/tests/annotation.c +2 -1
  92. data/vendor/local/share/gobject-introspection-1.0/tests/annotation.h +1 -1
  93. data/vendor/local/share/gobject-introspection-1.0/tests/regress.c +50 -1
  94. data/vendor/local/share/gobject-introspection-1.0/tests/regress.h +7 -0
  95. metadata +5 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9896b3867d16bb99da893e5d90cb8ef833f4741a
4
- data.tar.gz: 8c787c8dcf18e72268191399f94b27d2b9c8d426
3
+ metadata.gz: 21ab29d8b63370fc1cd673ae3eec08605fdfd1ae
4
+ data.tar.gz: 1a8f6ad50ed08ae63b3112d45a60c8734932d230
5
5
  SHA512:
6
- metadata.gz: f902afb3ab7951cd08ca2bf429c5f6c631e9481542712058c36894fe3e0219f0a96a5ebab0d61c80049c6e5fecb96f8948c6b09fc7b47edb58927fac8e1a06c3
7
- data.tar.gz: d78e007a91ebe10229fd4d8c9234fd0e34ee0f8ba3fdb1d8e861f6353c88440e79be236475b38b9205239db86ab3d3d7982d4fb64ae4f248934ba45b8dc3ce9b
6
+ metadata.gz: 0023689c186a8093a55e57caf657e0f45a6ee384ff675fb0dcf2fe443e9fdcf66dcba03599ba51c650ff25946cb2e6639d3eb7014daefbd5e05c9d9099a6c8ac
7
+ data.tar.gz: 017a1b87942c3d6200d40a82735d756e7118a31e7a78947883c1c0e14d960db6833bdcc72f44f0c6957cb9fec74e858c2d0f8767d6e3dc86c515e8ca7a6132f0
data/Rakefile CHANGED
@@ -32,7 +32,7 @@ package_task = GNOME2::Rake::PackageTask.new do |package|
32
32
  :name => "glib",
33
33
  :download_site => :gnome,
34
34
  :label => "GLib",
35
- :version => "2.52.3",
35
+ :version => "2.54.1",
36
36
  :compression_method => "xz",
37
37
  :windows => {
38
38
  :build => false,
@@ -47,7 +47,7 @@ package_task = GNOME2::Rake::PackageTask.new do |package|
47
47
  :name => "gobject-introspection",
48
48
  :download_site => :gnome,
49
49
  :label => "gobject-introspection",
50
- :version => "1.52.1",
50
+ :version => "1.54.1",
51
51
  :compression_method => "xz",
52
52
  :windows => {
53
53
  :configure_args => [
@@ -61,13 +61,14 @@ array_c_to_ruby_sized_interface(gconstpointer *elements,
61
61
  g_base_info_unref(interface_info);
62
62
  g_base_info_unref(element_type_info);
63
63
  } else {
64
- interface_name = g_info_type_to_string(interface_type);
64
+ /* TODO: Should we check caller_allocates? */
65
+ gsize struct_size = g_struct_info_get_size(interface_info);
66
+ for (i = 0; i < n_elements; i++) {
67
+ gpointer element = ((gchar *)elements) + struct_size * i;
68
+ rb_ary_push(rb_array, BOXED2RVAL(element, gtype));
69
+ }
65
70
  g_base_info_unref(interface_info);
66
71
  g_base_info_unref(element_type_info);
67
- rb_raise(rb_eNotImpError,
68
- "TODO: GIArgument(array)[c][interface(%s)](%s) -> Ruby",
69
- interface_name,
70
- g_type_name(gtype));
71
72
  }
72
73
  break;
73
74
  case GI_INFO_TYPE_BOXED:
@@ -131,12 +132,20 @@ array_c_to_ruby_sized(gconstpointer *elements,
131
132
 
132
133
  switch (element_type_tag) {
133
134
  case GI_TYPE_TAG_VOID:
134
- case GI_TYPE_TAG_BOOLEAN:
135
135
  g_base_info_unref(element_type_info);
136
136
  rb_raise(rb_eNotImpError,
137
137
  "TODO: GIArgument(array)[c][%s] -> Ruby",
138
138
  g_type_tag_to_string(element_type_tag));
139
139
  break;
140
+ case GI_TYPE_TAG_BOOLEAN:
141
+ g_base_info_unref(element_type_info);
142
+ {
143
+ const gboolean *booleans = (const gboolean *)elements;
144
+ for (i = 0; i < n_elements; i++) {
145
+ rb_ary_push(rb_array, CBOOL2RVAL(booleans[i]));
146
+ }
147
+ }
148
+ break;
140
149
  case GI_TYPE_TAG_INT8:
141
150
  g_base_info_unref(element_type_info);
142
151
  {
@@ -1146,8 +1155,15 @@ rb_gi_argument_to_ruby_ghash(GIArgument *argument, GITypeInfo *type_info)
1146
1155
  g_base_info_unref(value_type_info);
1147
1156
  rb_argument =
1148
1157
  rb_gi_argument_to_ruby_ghash_utf8_utf8(argument->v_pointer);
1149
- break;
1158
+ } else {
1159
+ g_base_info_unref(key_type_info);
1160
+ g_base_info_unref(value_type_info);
1161
+ rb_raise(rb_eNotImpError,
1162
+ "TODO: GIArgument(GHash)[%s][%s] -> Ruby",
1163
+ g_type_tag_to_string(key_type_tag),
1164
+ g_type_tag_to_string(value_type_tag));
1150
1165
  }
1166
+ break;
1151
1167
  case GI_TYPE_TAG_FILENAME:
1152
1168
  case GI_TYPE_TAG_ARRAY:
1153
1169
  case GI_TYPE_TAG_INTERFACE:
@@ -3330,6 +3346,22 @@ set_in_array_length_argument(GIArgument *argument,
3330
3346
  }
3331
3347
  }
3332
3348
 
3349
+ static void
3350
+ set_in_array_boolean_arguments_from_ruby(GIArgument *array_argument,
3351
+ VALUE rb_boolean_array)
3352
+ {
3353
+ gboolean *booleans;
3354
+ gint i, n_args;
3355
+
3356
+ n_args = RARRAY_LEN(rb_boolean_array);
3357
+ booleans = ALLOC_N(gboolean, n_args);
3358
+ for (i = 0; i < n_args; i++) {
3359
+ booleans[i] = RVAL2CBOOL(RARRAY_PTR(rb_boolean_array)[i]);
3360
+ }
3361
+
3362
+ array_argument->v_pointer = booleans;
3363
+ }
3364
+
3333
3365
  static void
3334
3366
  set_in_array_int8_arguments_from_ruby(GIArgument *array_argument,
3335
3367
  VALUE rb_number_array)
@@ -3644,11 +3676,16 @@ in_array_c_argument_from_ruby(GIArgument *array_argument,
3644
3676
  element_type_tag = g_type_info_get_tag(element_type_info);
3645
3677
  switch (element_type_tag) {
3646
3678
  case GI_TYPE_TAG_VOID:
3647
- case GI_TYPE_TAG_BOOLEAN:
3648
3679
  rb_raise(rb_eNotImpError,
3649
3680
  "TODO: Ruby -> GIArgument(array)[%s]",
3650
3681
  g_type_tag_to_string(element_type_tag));
3651
3682
  break;
3683
+ case GI_TYPE_TAG_BOOLEAN:
3684
+ rb_argument = rbg_to_array(rb_argument);
3685
+ set_in_array_boolean_arguments_from_ruby(array_argument, rb_argument);
3686
+ set_in_array_length_argument(length_argument, length_type_info,
3687
+ RARRAY_LEN(rb_argument));
3688
+ break;
3652
3689
  case GI_TYPE_TAG_INT8:
3653
3690
  if (RB_TYPE_P(rb_argument, RUBY_T_STRING)) {
3654
3691
  array_argument->v_pointer = RSTRING_PTR(rb_argument);
@@ -3953,11 +3990,13 @@ rb_gi_value_argument_free_array_c(VALUE rb_argument,
3953
3990
  element_type_tag = g_type_info_get_tag(element_type_info);
3954
3991
  switch (element_type_tag) {
3955
3992
  case GI_TYPE_TAG_VOID:
3956
- case GI_TYPE_TAG_BOOLEAN:
3957
3993
  rb_raise(rb_eNotImpError,
3958
3994
  "TODO: free GIArgument(array)[%s]",
3959
3995
  g_type_tag_to_string(element_type_tag));
3960
3996
  break;
3997
+ case GI_TYPE_TAG_BOOLEAN:
3998
+ xfree(argument->v_pointer);
3999
+ break;
3961
4000
  case GI_TYPE_TAG_INT8:
3962
4001
  case GI_TYPE_TAG_UINT8:
3963
4002
  if (RB_TYPE_P(rb_argument, RUBY_T_STRING)) {
@@ -3985,6 +4024,7 @@ rb_gi_value_argument_free_array_c(VALUE rb_argument,
3985
4024
  rb_raise(rb_eNotImpError,
3986
4025
  "TODO: free GIArgument(array)[%s]",
3987
4026
  g_type_tag_to_string(element_type_tag));
4027
+ break;
3988
4028
  case GI_TYPE_TAG_INTERFACE:
3989
4029
  xfree(argument->v_pointer);
3990
4030
  break;
@@ -1,6 +1,6 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
2
  /*
3
- * Copyright (C) 2012-2015 Ruby-GNOME2 Project Team
3
+ * Copyright (C) 2012-2017 Ruby-GNOME2 Project Team
4
4
  *
5
5
  * This library is free software; you can redistribute it and/or
6
6
  * modify it under the terms of the GNU Lesser General Public
@@ -23,6 +23,7 @@
23
23
  #define RG_TARGET_NAMESPACE rb_cGILoader
24
24
 
25
25
  static const gchar *boxed_class_converters_name = "@@boxed_class_converters";
26
+ static const gchar *object_class_converters_name = "@@object_class_converters";
26
27
 
27
28
  static VALUE
28
29
  rg_s_define_class(int argc, VALUE *argv, G_GNUC_UNUSED VALUE klass)
@@ -194,6 +195,76 @@ rg_s_register_boxed_class_converter(VALUE klass, VALUE rb_gtype)
194
195
  return Qnil;
195
196
  }
196
197
 
198
+ typedef struct {
199
+ GType type;
200
+ VALUE rb_converters;
201
+ VALUE rb_converter;
202
+ } ObjectInstance2RObjData;
203
+
204
+ static void
205
+ object_class_converter_free(gpointer user_data)
206
+ {
207
+ ObjectInstance2RObjData *data = user_data;
208
+ rb_ary_delete(data->rb_converters, data->rb_converter);
209
+ g_free(data);
210
+ }
211
+
212
+ static VALUE
213
+ object_instance2robj(gpointer instance, gpointer user_data)
214
+ {
215
+ ObjectInstance2RObjData *data = user_data;
216
+ VALUE existing_rb_instance;
217
+ VALUE default_rb_instance;
218
+ VALUE klass;
219
+ ID id_call;
220
+ VALUE converted_rb_instance;
221
+ ID id_unref;
222
+
223
+ existing_rb_instance = rbgobj_get_ruby_object_from_gobject(instance, FALSE);
224
+ if (!NIL_P(existing_rb_instance))
225
+ return existing_rb_instance;
226
+
227
+ default_rb_instance = rbgobj_get_ruby_object_from_gobject(instance, TRUE);
228
+ CONST_ID(id_call, "call");
229
+ klass = rb_funcall(data->rb_converter, id_call, 1, default_rb_instance);
230
+ if (klass == rb_class_of(default_rb_instance))
231
+ return default_rb_instance;
232
+
233
+ converted_rb_instance = rbgobj_object_alloc_func(klass);
234
+ g_object_ref(instance);
235
+ CONST_ID(id_unref, "unref");
236
+ rb_funcall(default_rb_instance, id_unref, 0);
237
+ rbgobj_gobject_initialize(converted_rb_instance, instance);
238
+ return converted_rb_instance;
239
+ }
240
+
241
+ static VALUE
242
+ rg_s_register_object_class_converter(VALUE klass, VALUE rb_gtype)
243
+ {
244
+ RGConvertTable table;
245
+ ObjectInstance2RObjData *data;
246
+ ID id_to_i;
247
+ VALUE object_class_converters;
248
+
249
+ memset(&table, 0, sizeof(RGConvertTable));
250
+ CONST_ID(id_to_i, "to_i");
251
+ table.type = NUM2ULONG(rb_funcall(rb_gtype, id_to_i, 0));
252
+ table.klass = Qnil;
253
+ table.instance2robj = object_instance2robj;
254
+
255
+ data = g_new(ObjectInstance2RObjData, 1);
256
+ data->type = table.type;
257
+ data->rb_converter = rb_block_proc();
258
+ object_class_converters = rb_cv_get(klass, object_class_converters_name);
259
+ rb_ary_push(object_class_converters, data->rb_converter);
260
+ table.user_data = data;
261
+ table.notify = object_class_converter_free;
262
+
263
+ rbgobj_convert_define(&table);
264
+
265
+ return Qnil;
266
+ }
267
+
197
268
  static VALUE
198
269
  rg_s_register_constant_rename_map(G_GNUC_UNUSED VALUE klass,
199
270
  VALUE rb_original,
@@ -260,12 +331,14 @@ rb_gi_loader_init(VALUE rb_mGI)
260
331
  RG_TARGET_NAMESPACE = rb_define_class_under(rb_mGI, "Loader", rb_cObject);
261
332
 
262
333
  rb_cv_set(RG_TARGET_NAMESPACE, boxed_class_converters_name, rb_ary_new());
334
+ rb_cv_set(RG_TARGET_NAMESPACE, object_class_converters_name, rb_ary_new());
263
335
 
264
336
  RG_DEF_SMETHOD(define_class, -1);
265
337
  RG_DEF_SMETHOD(define_interface, 3);
266
338
  RG_DEF_SMETHOD(define_struct, -1);
267
339
  RG_DEF_SMETHOD(define_error, -1);
268
340
  RG_DEF_SMETHOD(register_boxed_class_converter, 1);
341
+ RG_DEF_SMETHOD(register_object_class_converter, 1);
269
342
  RG_DEF_SMETHOD(register_constant_rename_map, 2);
270
343
  RG_DEF_SMETHOD(start_callback_dispatch_thread, 0);
271
344
  RG_DEF_SMETHOD(reference_gobject, -1);
Binary file
Binary file
Binary file
data/test/run-test.rb CHANGED
@@ -27,7 +27,7 @@ modules = [
27
27
  [gobject_introspection_base, "gobject-introspection"]
28
28
  ]
29
29
  modules.each do |target, module_name|
30
- if system("which make > /dev/null")
30
+ if File.exist?("#{target}/Makefile") and system("which make > /dev/null")
31
31
  `make -C #{target.dump} > /dev/null` or exit(false)
32
32
  end
33
33
  $LOAD_PATH.unshift(File.join(target, "ext", module_name))
Binary file
Binary file
Binary file
@@ -76,7 +76,7 @@ class CacheStore(object):
76
76
  try:
77
77
  with open(version, 'r') as version_file:
78
78
  cache_hash = version_file.read()
79
- except IOError as e:
79
+ except (IOError, OSError) as e:
80
80
  # File does not exist
81
81
  if e.errno == errno.ENOENT:
82
82
  cache_hash = 0
@@ -96,7 +96,7 @@ class CacheStore(object):
96
96
  # On Unix, this would just be os.rename() but Windows
97
97
  # doesn't allow that.
98
98
  shutil.move(tmp_filename, version)
99
- except IOError as e:
99
+ except (IOError, OSError) as e:
100
100
  # Permission denied
101
101
  if e.errno == errno.EACCES:
102
102
  return
@@ -121,15 +121,9 @@ class CacheStore(object):
121
121
  def _remove_filename(self, filename):
122
122
  try:
123
123
  os.unlink(filename)
124
- except IOError as e:
125
- # Permission denied
126
- if e.errno == errno.EACCES:
127
- return
128
- else:
129
- raise
130
- except OSError as e:
131
- # File does not exist
132
- if e.errno == errno.ENOENT:
124
+ except (IOError, OSError) as e:
125
+ # Ignore "permission denied", "file does not exist"
126
+ if e.errno in (errno.EACCES, errno.ENOENT):
133
127
  return
134
128
  else:
135
129
  raise
@@ -152,7 +146,7 @@ class CacheStore(object):
152
146
  try:
153
147
  with os.fdopen(tmp_fd, 'wb') as tmp_file:
154
148
  pickle.dump(data, tmp_file)
155
- except IOError as e:
149
+ except (IOError, OSError) as e:
156
150
  # No space left on device
157
151
  if e.errno == errno.ENOSPC:
158
152
  self._remove_filename(tmp_filename)
@@ -162,7 +156,7 @@ class CacheStore(object):
162
156
 
163
157
  try:
164
158
  shutil.move(tmp_filename, store_filename)
165
- except IOError as e:
159
+ except (IOError, OSError) as e:
166
160
  # Permission denied
167
161
  if e.errno == errno.EACCES:
168
162
  self._remove_filename(tmp_filename)
@@ -175,7 +169,7 @@ class CacheStore(object):
175
169
  return
176
170
  try:
177
171
  fd = open(store_filename, 'rb')
178
- except IOError as e:
172
+ except (IOError, OSError) as e:
179
173
  if e.errno == errno.ENOENT:
180
174
  return None
181
175
  else:
@@ -113,22 +113,18 @@ class CCompiler(object):
113
113
  # An "internal" link is where the library to be introspected
114
114
  # is being built in the current directory.
115
115
 
116
- if not libtool:
117
- # non-libtool case: prepare distutils use
118
- if self.check_is_msvc():
119
- for library in libraries + extra_libraries:
120
- # MSVC Builds don't use libtool, so no .la libraries,
121
- # so just add the library directly.
122
- self.compiler.add_library(library)
123
- for libpath in libpaths:
124
- self.compiler.add_library_dir(libpath)
125
- else:
126
- # Search the current directory first
127
- # (This flag is not supported nor needed for Visual C++)
128
- self.compiler.add_library_dir('.')
129
- if os.name != 'nt':
130
- self.compiler.add_runtime_library_dir('.')
116
+ runtime_path_envvar = []
117
+ runtime_paths = []
131
118
 
119
+ if self.check_is_msvc():
120
+ runtime_path_envvar = ['LIB', 'PATH']
121
+ else:
122
+ runtime_path_envvar = ['LD_LIBRARY_PATH']
123
+ # Search the current directory first
124
+ # (This flag is not supported nor needed for Visual C++)
125
+ args.append('-L.')
126
+
127
+ if not libtool:
132
128
  # https://bugzilla.gnome.org/show_bug.cgi?id=625195
133
129
  args.append('-Wl,-rpath,.')
134
130
 
@@ -137,37 +133,51 @@ class CCompiler(object):
137
133
  if sys.platform != 'darwin':
138
134
  args.append('-Wl,--no-as-needed')
139
135
 
140
- for library in libraries + extra_libraries:
141
- self.compiler.add_library(library)
142
- if not self.check_is_msvc():
143
- for library_path in libpaths:
144
- args.append('-L' + library_path)
145
- if os.path.isabs(library_path):
146
- args.append('-Wl,-rpath,' + library_path)
147
-
148
- else:
149
- # libtool case: assemble linker command arguments, like we did before
150
- args.append('-L.')
151
- for library in libraries:
136
+ for library in libraries + extra_libraries:
137
+ if self.check_is_msvc():
138
+ # Note that Visual Studio builds do not use libtool!
139
+ if library != 'm':
140
+ args.append(library + '.lib')
141
+ else:
152
142
  if library.endswith(".la"): # explicitly specified libtool library
153
143
  args.append(library)
154
144
  else:
155
145
  args.append('-l' + library)
156
146
 
157
- for library_path in libpaths:
147
+ for library_path in libpaths:
148
+ # The dumper program needs to look for dynamic libraries
149
+ # in the library paths first
150
+ if self.check_is_msvc():
151
+ library_path = library_path.replace('/', '\\')
152
+ args.append('-libpath:' + library_path)
153
+ else:
158
154
  args.append('-L' + library_path)
159
155
  if os.path.isabs(library_path):
160
- args.append('-rpath')
161
- args.append(library_path)
156
+ if libtool:
157
+ args.append('-rpath')
158
+ args.append(library_path)
159
+ else:
160
+ args.append('-Wl,-rpath,' + library_path)
161
+
162
+ runtime_paths.append(library_path)
162
163
 
163
- def get_external_link_flags(self, args, libtool, libraries):
164
+ for envvar in runtime_path_envvar:
165
+ if envvar in os.environ:
166
+ os.environ[envvar] = \
167
+ os.pathsep.join(runtime_paths + [os.environ[envvar]])
168
+ else:
169
+ os.environ[envvar] = os.pathsep.join(runtime_paths)
170
+
171
+ def get_external_link_flags(self, args, libraries):
164
172
  # An "external" link is where the library to be introspected
165
173
  # is installed on the system; this case is used for the scanning
166
174
  # of GLib in gobject-introspection itself.
167
175
 
168
176
  for library in libraries:
169
- if not libtool:
170
- self.compiler.add_library(library)
177
+ if self.check_is_msvc():
178
+ # Visual Studio: don't attempt to link to m.lib
179
+ if library != 'm':
180
+ args.append(library + ".lib")
171
181
  else:
172
182
  if library.endswith(".la"): # explicitly specified libtool library
173
183
  args.append(library)
@@ -238,24 +248,7 @@ class CCompiler(object):
238
248
  macros=macros,
239
249
  include_dirs=includes,
240
250
  extra_postargs=extra_postargs,
241
- output_dir=str(source_str[tmpdir_idx + 1:
242
- source_str.rfind(os.sep)]))
243
-
244
- def link(self, output, objects, lib_args):
245
- # Note: This is used for non-libtool builds only!
246
- extra_preargs = []
247
- extra_postargs = []
248
- library_dirs = []
249
- libraries = []
250
-
251
- for arg in lib_args:
252
- extra_postargs.append(arg)
253
-
254
- self.compiler.link(target_desc=self.compiler.EXECUTABLE,
255
- objects=objects,
256
- output_filename=output,
257
- extra_preargs=extra_preargs,
258
- extra_postargs=extra_postargs)
251
+ output_dir=os.path.abspath(os.sep))
259
252
 
260
253
  def resolve_windows_libs(self, libraries, options):
261
254
  args = []
@@ -279,6 +272,10 @@ class CCompiler(object):
279
272
  args.append('dumpbin.exe')
280
273
  args.append('-symbols')
281
274
 
275
+ # Work around the attempt to resolve m.lib on Python 2.x
276
+ if sys.version_info.major < 3:
277
+ libraries[:] = [lib for lib in libraries if lib != 'm']
278
+
282
279
  # When we are not using Visual C++ (i.e. we are using GCC)...
283
280
  else:
284
281
  libtool = utils.get_libtool_command(options)